From 861b7519c0e0f93434850a993d7d6f0cca8f62ec86f4f70a7da30204882eb8ef Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 19 Dec 2024 06:05:33 +0000 Subject: [PATCH] - Add patch support-new-httpx.patch: * Support new arguments for httpx 0.28.0+ OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-softlayer-zeep?expand=0&rev=15 --- .gitattributes | 23 +++++++++ .gitignore | 1 + python-softlayer-zeep.changes | 40 +++++++++++++++ python-softlayer-zeep.spec | 94 +++++++++++++++++++++++++++++++++++ skip-networked-test.patch | 76 ++++++++++++++++++++++++++++ softlayer-zeep-5.0.0.tar.gz | 3 ++ support-new-httpx.patch | 65 ++++++++++++++++++++++++ xsd-date.patch | 46 +++++++++++++++++ 8 files changed, 348 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 python-softlayer-zeep.changes create mode 100644 python-softlayer-zeep.spec create mode 100644 skip-networked-test.patch create mode 100644 softlayer-zeep-5.0.0.tar.gz create mode 100644 support-new-httpx.patch create mode 100644 xsd-date.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/python-softlayer-zeep.changes b/python-softlayer-zeep.changes new file mode 100644 index 0000000..3102936 --- /dev/null +++ b/python-softlayer-zeep.changes @@ -0,0 +1,40 @@ +------------------------------------------------------------------- +Thu Dec 19 06:04:42 UTC 2024 - Steve Kowalik + +- Add patch support-new-httpx.patch: + * Support new arguments for httpx 0.28.0+ + +------------------------------------------------------------------- +Thu Nov 14 12:18:00 UTC 2024 - Markéta Machová + +- Add xsd-date.patch to fix test failure +- Stop providing/obsoleting python-zeep, as the latter exists in OBS + and is more up-to-date on a lower version + +------------------------------------------------------------------- +Tue Oct 29 05:34:42 UTC 2024 - Steve Kowalik + +- Add {Build,}Requires on legacy-cgi to support Python 3.13. +- Update VCS URL. + +------------------------------------------------------------------- +Tue Dec 19 13:34:00 UTC 2023 - Matej Cepl + +- Add skip-networked-test.patch to fix + gh#mvantellingen/python-zeep#1402 skipping tests requiring + network connection + +------------------------------------------------------------------- +Sat Jul 1 09:08:59 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Fri Jul 8 07:47:52 UTC 2022 - Dirk Müller + +- make it provide/obsolete python-zeep as it is a fork of it + +------------------------------------------------------------------- +Thu Jul 7 10:48:50 UTC 2022 - Dirk Müller + +- Initial package (5.0.0) diff --git a/python-softlayer-zeep.spec b/python-softlayer-zeep.spec new file mode 100644 index 0000000..6807d1a --- /dev/null +++ b/python-softlayer-zeep.spec @@ -0,0 +1,94 @@ +# +# spec file for package python-softlayer-zeep +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-softlayer-zeep +Version: 5.0.0 +Release: 0 +Summary: A modern/fast Python SOAP client based on lxml / requests +License: MIT +#Git-Clone: https://github.com/softlayer/softlayer-zeep +URL: https://docs.python-zeep.org +Source: https://files.pythonhosted.org/packages/source/s/softlayer-zeep/softlayer-zeep-%{version}.tar.gz +# PATCH-FIX-UPSTREAM skip-networked-test.patch gh#mvantellingen/python-zeep#1402 mcepl@suse.com +# skip tests requiring network connection +Patch0: skip-networked-test.patch +# PATCH-FIX-UPSTREAM gh#mvantellingen/python-zeep#d1b0257 Fix regression in parsing xsd:Date with negative timezone +Patch1: xsd-date.patch +# PATCH-FIX-UPSTREAM Based on gh#mvantellingen/python-zeep#1447 +Patch2: support-new-httpx.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-attrs >= 17.2.0 +Requires: python-isodate >= 0.5.4 +Requires: python-lxml >= 4.6.0 +Requires: python-platformdirs >= 1.4.0 +Requires: python-pytz +Requires: python-requests >= 2.7.0 +Requires: python-requests-file >= 1.5.1 +Requires: python-requests-toolbelt >= 0.7.1 +Conflicts: python-zeep +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module attrs >= 17.2.0} +BuildRequires: %{python_module freezegun >= 0.3.15} +BuildRequires: %{python_module isodate >= 0.5.4} +BuildRequires: %{python_module isort >= 5.3.2} +BuildRequires: %{python_module legacy-cgi >= 2.6} +BuildRequires: %{python_module lxml >= 4.6.0} +BuildRequires: %{python_module platformdirs >= 1.4.0} +BuildRequires: %{python_module pretend == 1.0.9} +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module pytest-httpx} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module pytz} +BuildRequires: %{python_module requests >= 2.7.0} +BuildRequires: %{python_module requests-file >= 1.5.1} +BuildRequires: %{python_module requests-mock >= 0.7.0} +BuildRequires: %{python_module requests-toolbelt >= 0.7.1} +# /SECTION +%if 0%{?python_version_nodots} >= 313 +Requires: python-legacy-cgi >= 2.6 +%endif +%python_subpackages + +%description +A modern/fast Python SOAP client based on lxml / requests + +%prep +%autosetup -p1 -n softlayer-zeep-%{version} + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest -k 'not network' + +%files %{python_files} +%doc CHANGES README.rst +%license LICENSE +%{python_sitelib}/zeep +%{python_sitelib}/softlayer_zeep-%{version}.dist-info + +%changelog diff --git a/skip-networked-test.patch b/skip-networked-test.patch new file mode 100644 index 0000000..5acf7a9 --- /dev/null +++ b/skip-networked-test.patch @@ -0,0 +1,76 @@ +--- + pyproject.toml | 3 ++- + tests/test_cache.py | 4 ++++ + tests/test_wsse_username.py | 3 +++ + 3 files changed, 9 insertions(+), 1 deletion(-) + +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -28,5 +28,6 @@ testpaths = [ + ] + markers = [ + # mark a test to allow socket usage +- "requests" ++ "requests", ++ "network: test case requires network connection", + ] +--- a/tests/test_cache.py ++++ b/tests/test_cache.py +@@ -35,6 +35,7 @@ class TestSqliteCache: + result = c.get("http://tests.python-zeep.org/example.wsdl") + assert result is None + ++ @pytest.mark.network + def test_has_expired(self, tmpdir): + c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath) + c.add("http://tests.python-zeep.org/example.wsdl", b"content") +@@ -51,6 +52,7 @@ class TestSqliteCache: + assert result == b"content" + + ++@pytest.mark.network + def test_memory_cache_timeout(tmpdir): + c = cache.InMemoryCache() + c.add("http://tests.python-zeep.org/example.wsdl", b"content") +@@ -76,6 +78,7 @@ class TestIsExpired: + def test_timeout_none(self): + assert cache._is_expired(100, None) is False + ++ @pytest.mark.network + def test_has_expired(self): + timeout = 7200 + utcnow = datetime.datetime.utcnow() +@@ -83,6 +86,7 @@ class TestIsExpired: + with freezegun.freeze_time(utcnow): + assert cache._is_expired(value, timeout) is False + ++ @pytest.mark.network + def test_has_not_expired(self): + timeout = 7200 + utcnow = datetime.datetime.utcnow() +--- a/tests/test_wsse_username.py ++++ b/tests/test_wsse_username.py +@@ -85,6 +85,7 @@ def test_password_text(): + assert_nodes_equal(envelope, expected) + + ++@pytest.mark.network + @freeze_time("2016-05-08 12:00:00") + def test_password_digest(monkeypatch): + monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random") +@@ -138,6 +139,7 @@ def test_password_digest(monkeypatch): + assert_nodes_equal(envelope, expected) + + ++@pytest.mark.network + @freeze_time("2016-05-08 12:00:00") + def test_password_digest_custom(monkeypatch): + monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random") +@@ -323,6 +325,7 @@ def test_timestamp_token(): + assert_nodes_equal(envelope, expected) + + ++@pytest.mark.network + @freeze_time("2016-05-08 12:00:00") + def test_bytes_like_password_digest(monkeypatch): + monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random") diff --git a/softlayer-zeep-5.0.0.tar.gz b/softlayer-zeep-5.0.0.tar.gz new file mode 100644 index 0000000..3f5af9c --- /dev/null +++ b/softlayer-zeep-5.0.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff690c115eecaececa437bfe81430e9fdb49690e6465397c9dc77eb56b681e23 +size 164776 diff --git a/support-new-httpx.patch b/support-new-httpx.patch new file mode 100644 index 0000000..b1f253d --- /dev/null +++ b/support-new-httpx.patch @@ -0,0 +1,65 @@ +From 4e2568574271e5e37de5e5c86e4bb12a5e661c6b Mon Sep 17 00:00:00 2001 +From: aschollmeier-gcmlp +Date: Wed, 4 Dec 2024 16:34:22 -0600 +Subject: [PATCH 1/3] Update proxy argument in httpx Client/AsyncClient + +Ref: https://github.com/encode/httpx/blob/master/CHANGELOG.md#0260-20th-december-2023 +--- + src/zeep/transports.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +Index: softlayer-zeep-5.0.0/src/zeep/transports.py +=================================================================== +--- softlayer-zeep-5.0.0.orig/src/zeep/transports.py ++++ softlayer-zeep-5.0.0/src/zeep/transports.py +@@ -16,6 +16,15 @@ try: + except ImportError: + httpx = None + ++try: ++ from packaging.version import Version ++ if httpx is None or Version(httpx.__version__) < Version("0.26.0"): ++ HTTPX_PROXY_KWARG_NAME = "proxies" ++ else: ++ HTTPX_PROXY_KWARG_NAME = "proxy" ++except ImportError: ++ Version = None ++ HTTPX_PROXY_KWARG_NAME = None + + __all__ = ["AsyncTransport", "Transport"] + +@@ -182,15 +191,16 @@ class AsyncTransport(Transport): + raise RuntimeError("The AsyncTransport is based on the httpx module") + + self.cache = cache ++ proxy_kwargs = {HTTPX_PROXY_KWARG_NAME: proxy} + self.wsdl_client = wsdl_client or httpx.Client( + verify=verify_ssl, +- proxies=proxy, + timeout=timeout, ++ **proxy_kwargs, + ) + self.client = client or httpx.AsyncClient( + verify=verify_ssl, +- proxies=proxy, + timeout=operation_timeout, ++ **proxy_kwargs, + ) + self.logger = logging.getLogger(__name__) + +Index: softlayer-zeep-5.0.0/setup.py +=================================================================== +--- softlayer-zeep-5.0.0.orig/setup.py ++++ softlayer-zeep-5.0.0/setup.py +@@ -18,7 +18,10 @@ docs_require = [ + "sphinx>=1.4.0", + ] + +-async_require = ["httpx"] ++async_require = [ ++ "httpx", ++ "packaging" ++] + + xmlsec_require = [ + "xmlsec>=0.6.1", diff --git a/xsd-date.patch b/xsd-date.patch new file mode 100644 index 0000000..2e57138 --- /dev/null +++ b/xsd-date.patch @@ -0,0 +1,46 @@ +From d1b0257eb7b8f41bc74c0fa178e820c2d739cf30 Mon Sep 17 00:00:00 2001 +From: Michael van Tellingen +Date: Wed, 16 Oct 2024 07:21:21 +0200 +Subject: [PATCH] Fix regression in parsing xsd:Date with negative timezone + +--- + CHANGES | 4 ++++ + src/zeep/xsd/types/builtins.py | 12 +++++------- + tests/test_xsd_builtins.py | 2 ++ + 3 files changed, 11 insertions(+), 7 deletions(-) + +Index: softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py +=================================================================== +--- softlayer-zeep-5.0.0.orig/src/zeep/xsd/types/builtins.py ++++ softlayer-zeep-5.0.0/src/zeep/xsd/types/builtins.py +@@ -201,6 +201,7 @@ class Time(BuiltinType): + class Date(BuiltinType): + _default_qname = xsd_ns("date") + accepted_types = [datetime.date, str] ++ _pattern = re.compile(r"(\d{4})-(\d{2})-(\d{2})") + + @check_no_collection + def xmlvalue(self, value): +@@ -210,6 +211,9 @@ class Date(BuiltinType): + + @treat_whitespace("collapse") + def pythonvalue(self, value): ++ m = self._pattern.match(value) ++ if m: ++ return datetime.date(*map(int, m.groups())) + return isodate.parse_date(value) + + +Index: softlayer-zeep-5.0.0/tests/test_xsd_builtins.py +=================================================================== +--- softlayer-zeep-5.0.0.orig/tests/test_xsd_builtins.py ++++ softlayer-zeep-5.0.0/tests/test_xsd_builtins.py +@@ -242,6 +242,8 @@ class TestDate: + instance = builtins.Date() + assert instance.pythonvalue("2016-03-04") == datetime.date(2016, 3, 4) + assert instance.pythonvalue("2001-10-26+02:00") == datetime.date(2001, 10, 26) ++ assert instance.pythonvalue("2001-10-26-02:00") == datetime.date(2001, 10, 26) ++ assert instance.pythonvalue("2024-08-21-10:00") == datetime.date(2024, 8, 21) + assert instance.pythonvalue("2001-10-26Z") == datetime.date(2001, 10, 26) + assert instance.pythonvalue("2001-10-26+00:00") == datetime.date(2001, 10, 26) + assert instance.pythonvalue("\r\n\t 2016-03-04 ") == datetime.date(2016, 3, 4)