commit:     af6f0ed5a2ccefe8c4259a3d5be3ff8ddb05bbf6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 11 10:25:30 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Nov 11 10:26:50 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af6f0ed5

dev-python/zeep: Eliminate dev-python/cached-property dep

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/zeep/files/zeep-4.1.0-cached-prop.patch | 100 +++++++++++++++++++++
 .../{zeep-4.1.0.ebuild => zeep-4.1.0-r1.ebuild}    |   7 +-
 2 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/dev-python/zeep/files/zeep-4.1.0-cached-prop.patch 
b/dev-python/zeep/files/zeep-4.1.0-cached-prop.patch
new file mode 100644
index 00000000000..368dca71ad3
--- /dev/null
+++ b/dev-python/zeep/files/zeep-4.1.0-cached-prop.patch
@@ -0,0 +1,100 @@
+From 25701f0b69ee46914179070b7e8906ea3e521480 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Thu, 11 Nov 2021 08:55:41 +0100
+Subject: [PATCH] Use stdlib functools.cached_property if available
+
+Python 3.8+ provides a functools.cached_property in the stdlib that is
+thread-safe, i.e. equivalent to threaded_cached_property.  Use it
+instead of adding third-party dependencies whenever available.
+---
+ setup.py                            | 2 +-
+ src/zeep/wsdl/attachments.py        | 6 +++++-
+ src/zeep/xsd/elements/indicators.py | 6 +++++-
+ src/zeep/xsd/types/any.py           | 6 +++++-
+ src/zeep/xsd/types/complex.py       | 6 +++++-
+ 5 files changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index cb51ac4..8ef81b6 100755
+--- a/setup.py
++++ b/setup.py
+@@ -4,7 +4,7 @@ from setuptools import setup
+ 
+ install_requires = [
+     "attrs>=17.2.0",
+-    "cached-property>=1.3.0",
++    "cached-property>=1.3.0; python_version<'3.8'",
+     "isodate>=0.5.4",
+     "lxml>=4.6.0",
+     "platformdirs>=1.4.0",
+diff --git a/src/zeep/wsdl/attachments.py b/src/zeep/wsdl/attachments.py
+index 037e439..075bee5 100644
+--- a/src/zeep/wsdl/attachments.py
++++ b/src/zeep/wsdl/attachments.py
+@@ -6,7 +6,11 @@ See https://www.w3.org/TR/SOAP-attachments
+ 
+ import base64
+ 
+-from cached_property import cached_property
++try:
++    from functools import cached_property
++except ImportError:
++    from cached_property import cached_property
++
+ from requests.structures import CaseInsensitiveDict
+ 
+ 
+diff --git a/src/zeep/xsd/elements/indicators.py 
b/src/zeep/xsd/elements/indicators.py
+index 40325da..e9ef2c4 100644
+--- a/src/zeep/xsd/elements/indicators.py
++++ b/src/zeep/xsd/elements/indicators.py
+@@ -16,7 +16,11 @@ import operator
+ import typing
+ from collections import OrderedDict, defaultdict, deque
+ 
+-from cached_property import threaded_cached_property
++try:
++    from functools import cached_property as threaded_cached_property
++except ImportError:
++    from cached_property import threaded_cached_property
++
+ from lxml import etree
+ 
+ from zeep.exceptions import UnexpectedElementError, ValidationError
+diff --git a/src/zeep/xsd/types/any.py b/src/zeep/xsd/types/any.py
+index b4525e4..17f244e 100644
+--- a/src/zeep/xsd/types/any.py
++++ b/src/zeep/xsd/types/any.py
+@@ -1,7 +1,11 @@
+ import logging
+ import typing
+ 
+-from cached_property import threaded_cached_property
++try:
++    from functools import cached_property as threaded_cached_property
++except ImportError:
++    from cached_property import threaded_cached_property
++
+ from lxml import etree
+ 
+ from zeep.utils import qname_attr
+diff --git a/src/zeep/xsd/types/complex.py b/src/zeep/xsd/types/complex.py
+index 8141bc1..b2ed9bf 100644
+--- a/src/zeep/xsd/types/complex.py
++++ b/src/zeep/xsd/types/complex.py
+@@ -4,7 +4,11 @@ import typing
+ from collections import OrderedDict, deque
+ from itertools import chain
+ 
+-from cached_property import threaded_cached_property
++try:
++    from functools import cached_property as threaded_cached_property
++except ImportError:
++    from cached_property import threaded_cached_property
++
+ from lxml import etree
+ 
+ from zeep.exceptions import UnexpectedElementError, XMLParseError
+-- 
+2.33.1
+

diff --git a/dev-python/zeep/zeep-4.1.0.ebuild 
b/dev-python/zeep/zeep-4.1.0-r1.ebuild
similarity index 95%
rename from dev-python/zeep/zeep-4.1.0.ebuild
rename to dev-python/zeep/zeep-4.1.0-r1.ebuild
index 579382f9cb1..e9a0162f28d 100644
--- a/dev-python/zeep/zeep-4.1.0.ebuild
+++ b/dev-python/zeep/zeep-4.1.0-r1.ebuild
@@ -18,7 +18,6 @@ IUSE="async"
 
 RDEPEND="
        >=dev-python/attrs-17.2.0[${PYTHON_USEDEP}]
-       >=dev-python/cached-property-1.3.0[${PYTHON_USEDEP}]
        >=dev-python/isodate-0.5.4[${PYTHON_USEDEP}]
        >=dev-python/lxml-4.6.0[${PYTHON_USEDEP}]
        >=dev-python/platformdirs-1.4.0[${PYTHON_USEDEP}]
@@ -27,6 +26,8 @@ RDEPEND="
        >=dev-python/requests-toolbelt-0.7.1[${PYTHON_USEDEP}]
        dev-python/pytz[${PYTHON_USEDEP}]
        async? ( >=dev-python/aiohttp-1.0[${PYTHON_USEDEP}] )
+"
+BDEPEND="
        test? (
                dev-python/aiohttp[${PYTHON_USEDEP}]
                dev-python/aioresponses[${PYTHON_USEDEP}]
@@ -41,3 +42,7 @@ RDEPEND="
 "
 
 distutils_enable_tests pytest
+
+PATCHES=(
+       "${FILESDIR}"/${P}-cached-prop.patch
+)

Reply via email to