From 425a500985bb3ee6e6aa6b54e15b734d3714faf1 Mon Sep 17 00:00:00 2001 From: 19909236985 Date: Tue, 4 Aug 2020 18:27:56 +0800 Subject: [PATCH 1/3] add patch --- Remove-tests-that-use-the-tarpit.patch | 48 +++++++++++++++++++ _service | 6 +++ ...certs.py-to-use-the-system-CA-bundle.patch | 36 ++++++++++++++ python-requests.spec | 8 ++-- 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 Remove-tests-that-use-the-tarpit.patch create mode 100644 _service create mode 100644 patch-requests-certs.py-to-use-the-system-CA-bundle.patch diff --git a/Remove-tests-that-use-the-tarpit.patch b/Remove-tests-that-use-the-tarpit.patch new file mode 100644 index 0000000..86b65c1 --- /dev/null +++ b/Remove-tests-that-use-the-tarpit.patch @@ -0,0 +1,48 @@ +From bb1c91432c5e9a1f402692db5c80c65136656afb Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Tue, 13 Jun 2017 09:08:09 -0400 +Subject: [PATCH] Remove tests that use the tarpit + +The latest version of Mock has started using systemd containers. The +systemd-nspawn command is being run with --private-network, which +immediately kills connections to something other than localhost. These +tests depend on the connection not being killed immediately and that +they are never responded to. + +Signed-off-by: Jeremy Cline +--- +diff -Naur requests-2.24.0/tests/test_requests.py requests-2/tests/test_requests.py +--- requests-2.24.0/tests/test_requests.py 2020-08-04 18:05:14.250000000 +0800 ++++ requests-2/tests/test_requests.py 2020-08-04 18:13:19.891000000 +0800 +@@ -2188,30 +2188,6 @@ + except ReadTimeout: + pass + +- @pytest.mark.parametrize( +- 'timeout', ( +- (0.1, None), +- Urllib3Timeout(connect=0.1, read=None) +- )) +- def test_connect_timeout(self, timeout): +- try: +- requests.get(TARPIT, timeout=timeout) +- pytest.fail('The connect() request should time out.') +- except ConnectTimeout as e: +- assert isinstance(e, ConnectionError) +- assert isinstance(e, Timeout) +- +- @pytest.mark.parametrize( +- 'timeout', ( +- (0.1, 0.1), +- Urllib3Timeout(connect=0.1, read=0.1) +- )) +- def test_total_timeout_connect(self, timeout): +- try: +- requests.get(TARPIT, timeout=timeout) +- pytest.fail('The connect() request should time out.') +- except ConnectTimeout: +- pass + + def test_encoded_methods(self, httpbin): + """See: https://github.com/psf/requests/issues/2316""" + diff --git a/_service b/_service new file mode 100644 index 0000000..6210117 --- /dev/null +++ b/_service @@ -0,0 +1,6 @@ + + + repo + next/openEuler/python-requests + + diff --git a/patch-requests-certs.py-to-use-the-system-CA-bundle.patch b/patch-requests-certs.py-to-use-the-system-CA-bundle.patch new file mode 100644 index 0000000..739bf5c --- /dev/null +++ b/patch-requests-certs.py-to-use-the-system-CA-bundle.patch @@ -0,0 +1,36 @@ +From aad5590d5ea47dc54cfd97da54f2640014f7d39d Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Thu, 13 Dec 2018 10:55:29 -0500 +Subject: [PATCH] Patch requests/certs.py to use the system CA bundle + +Signed-off-by: Jeremy Cline +--- +diff -Naur requests-2.24.0/requests/certs.py requests-1/requests/certs.py +--- requests-2.24.0/requests/certs.py 2020-08-04 18:05:14.250000000 +0800 ++++ requests-1/requests/certs.py 2020-08-04 18:07:20.652000000 +0800 +@@ -10,8 +10,13 @@ + If you are packaging Requests, e.g., for a Linux distribution or a managed + environment, you can change the definition of where() to return a separately + packaged CA bundle. ++ ++This Fedora-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided ++by the ca-certificates RPM package. + """ +-from certifi import where ++def where(): ++ """Return the absolute path to the system CA bundle.""" ++ return '/etc/pki/tls/certs/ca-bundle.crt' + + if __name__ == '__main__': + print(where()) +diff -Naur requests-2.24.0/setup.py requests-1/setup.py +--- requests-2.24.0/setup.py 2020-08-04 18:05:14.250000000 +0800 ++++ requests-1/setup.py 2020-08-04 18:07:46.508000000 +0800 +@@ -45,7 +45,6 @@ + 'chardet>=3.0.2,<4', + 'idna>=2.5,<3', + 'urllib3>=1.21.1,<1.26,!=1.25.0,!=1.25.1', +- 'certifi>=2017.4.17' + + ] + test_requirements = [ diff --git a/python-requests.spec b/python-requests.spec index 3669aee..9eddf89 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -8,8 +8,10 @@ License: ASL 2.0 URL: http://python-requests.org/ Source0: https://github.com/psf/requests/archive/v%{version}.tar.gz -Patch3: requests-2.12.4-tests_nonet.patch -Patch5: requests-2.20.0-no-py2-httpbin.patch +Patch1: requests-2.12.4-tests_nonet.patch +Patch2: requests-2.20.0-no-py2-httpbin.patch +Patch3: patch-requests-certs.py-to-use-the-system-CA-bundle.patch +Patch4: Remove-tests-that-use-the-tarpit.patch BuildArch: noarch @@ -135,4 +137,4 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v - DESC:add the provides of python3 * Wed Sep 25 2019 openEuler Buildteam - 2.21.0-1 -- Package init \ No newline at end of file +- Package init -- Gitee From c075559d2a97fc388cf2b6bb0298a03737189522 Mon Sep 17 00:00:00 2001 From: 19909236985 Date: Tue, 4 Aug 2020 18:37:44 +0800 Subject: [PATCH 2/3] change log --- python-requests.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python-requests.spec b/python-requests.spec index 9eddf89..d233251 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -2,7 +2,7 @@ Name: python-requests Version: 2.24.0 -Release: 1 +Release: 2 Summary: Python HTTP Library License: ASL 2.0 URL: http://python-requests.org/ @@ -112,6 +112,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v %doc HISTORY.md README.md %changelog +*Tue Aug 4 2020 wuchaochao - 2.24.0-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: add patch-requests-certs.py-to-use-the-system-CA-bundle.patch and Remove-tests-that-use-the-tarpit.patch + * Thu Jul 23 2020 wuchaochao - 2.24.0-1 - update package to 2.24.0 -- Gitee From a27b25f68c1c7f183ab4f70e9ad3bbc171087aa6 Mon Sep 17 00:00:00 2001 From: 19909236985 Date: Tue, 4 Aug 2020 19:13:07 +0800 Subject: [PATCH 3/3] remove reliance --- _service | 6 ------ python-requests.spec | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 _service diff --git a/_service b/_service deleted file mode 100644 index 6210117..0000000 --- a/_service +++ /dev/null @@ -1,6 +0,0 @@ - - - repo - next/openEuler/python-requests - - diff --git a/python-requests.spec b/python-requests.spec index d233251..9eaa8b8 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -116,7 +116,7 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v - Type:bugfix - ID:NA - SUG:NA -- DESC: add patch-requests-certs.py-to-use-the-system-CA-bundle.patch and Remove-tests-that-use-the-tarpit.patch +- DESC: remove reliance on "certifi" * Thu Jul 23 2020 wuchaochao - 2.24.0-1 - update package to 2.24.0 -- Gitee