diff --git a/backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch b/backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch index bba7bc299b5d9f190e600b21f8d19cc2399a0e3a..2a68ec2ce528c5cd8edfd3f9a7ef106babb10a2e 100644 --- a/backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch +++ b/backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch @@ -1,41 +1,45 @@ -From cc1b9954ca7dcd90a694f7e2e9990c883bf7b647 Mon Sep 17 00:00:00 2001 -From: Lumir Balhar -Date: Wed, 21 Jul 2021 12:05:53 +0200 -Subject: [PATCH] patch-requests-certs.py-to-use-the-system-CA-bundle +From 7df5d559ab69eb782ab2b25e7e4e827a202e68c7 Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 15 Apr 2024 16:38:00 +0800 +Subject: [PATCH 2/3] patch-requests-certs.py-to-use-the-system-CA-bundle -Reference: -https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/patch-requests-certs.py-to-use-the-system-CA-bundle.patch --- + requests/certs.py | 8 +++++++- + setup.py | 1 - + 2 files changed, 7 insertions(+), 2 deletions(-) + diff --git a/requests/certs.py b/requests/certs.py -index a14a7ee..a1841ca 100644 +index be422c3..6b4f8b0 100644 --- a/requests/certs.py +++ b/requests/certs.py -@@ -10,8 +10,12 @@ only one — the one from the certifi package. +@@ -10,8 +10,14 @@ only one — the one from the certifi package. 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. --""" --from certifi import where - ++ +This OpenEuler-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__': + + if __name__ == "__main__": print(where()) diff --git a/setup.py b/setup.py -index ce5e5c8..de86a91 100755 +index 23977ed..599533c 100755 --- a/setup.py +++ b/setup.py -@@ -46,7 +46,6 @@ requires = [ - 'idna>=2.5,<3; python_version < "3"', - 'idna>=2.5,<4; python_version >= "3"', - 'urllib3>=1.21.1,<1.27', -- 'certifi>=2017.4.17' - +@@ -62,7 +62,6 @@ requires = [ + "charset_normalizer>=2,<3", + "idna>=2.5,<4", + "urllib3>=1.21.1,<1.27", +- "certifi>=2017.4.17", ] test_requirements = [ --- -2.27.0 \ No newline at end of file + "pytest-httpbin==0.0.7", +-- +2.43.0 + diff --git a/backport-remove-tests-that-use-the-tarpit.patch b/backport-remove-tests-that-use-the-tarpit.patch index 4a9ea3e7edf294e1e4e03c697ade8f8d288f7e61..1d474599bc2224461ffd292abc7c13311d60ddca 100644 --- a/backport-remove-tests-that-use-the-tarpit.patch +++ b/backport-remove-tests-that-use-the-tarpit.patch @@ -1,51 +1,44 @@ -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 +From 551a9281536b72b99484febb0de4c956649534f2 Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 15 Apr 2024 16:49:08 +0800 +Subject: [PATCH 3/3] Remove tests that use the tarpit -Reference: -https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/Remove-tests-that-use-the-tarpit.patch --- -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 @@ + tests/test_requests.py | 21 --------------------- + 1 file changed, 21 deletions(-) + +diff --git a/tests/test_requests.py b/tests/test_requests.py +index 5b4c3f5..4af5808 100644 +--- a/tests/test_requests.py ++++ b/tests/test_requests.py +@@ -2425,27 +2425,6 @@ class TestTimeout: except ReadTimeout: pass - + - @pytest.mark.parametrize( -- 'timeout', ( -- (0.1, None), -- Urllib3Timeout(connect=0.1, read=None) -- )) +- "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.') +- 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) -- )) +- "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.') +- 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""" + r = requests.request(b"GET", httpbin("get")) +-- +2.43.0 diff --git a/backport-requests-2.12.4-tests_nonet.patch b/backport-requests-2.12.4-tests_nonet.patch deleted file mode 100644 index d1d5731ab5afb45cc894b00b91254e6ff24e82a1..0000000000000000000000000000000000000000 --- a/backport-requests-2.12.4-tests_nonet.patch +++ /dev/null @@ -1,13 +0,0 @@ -Reference: -https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/requests-2.12.4-tests_nonet.patch ---- requests-2.12.4/tests/testserver/server.py 2016-12-21 11:31:56.000000000 -0800 -+++ requests-2.12.4/tests/testserver/server.py.new 2016-12-30 10:40:06.085995065 -0800 -@@ -27,7 +27,7 @@ - """Dummy server using for unit testing""" - WAIT_EVENT_TIMEOUT = 5 - -- def __init__(self, handler=None, host='localhost', port=0, requests_to_handle=1, wait_to_close_event=None): -+ def __init__(self, handler=None, host='127.0.0.1', port=0, requests_to_handle=1, wait_to_close_event=None): - super(Server, self).__init__() - - self.handler = handler or consume_socket_content diff --git a/backport-use-localhost-ip-for-no-net.patch b/backport-use-localhost-ip-for-no-net.patch new file mode 100644 index 0000000000000000000000000000000000000000..a206e680521c18a153331ac31faff1c00b9e756e --- /dev/null +++ b/backport-use-localhost-ip-for-no-net.patch @@ -0,0 +1,25 @@ +From b71d7cbc6495f6841f83fca675d565ee56950f4a Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 15 Apr 2024 16:31:51 +0800 +Subject: [PATCH 1/3] use localhost ip for no net + +--- + tests/testserver/server.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/testserver/server.py b/tests/testserver/server.py +index 5936abd..a77d130 100644 +--- a/tests/testserver/server.py ++++ b/tests/testserver/server.py +@@ -29,7 +29,7 @@ class Server(threading.Thread): + def __init__( + self, + handler=None, +- host="localhost", ++ host="127.0.0.1", + port=0, + requests_to_handle=1, + wait_to_close_event=None, +-- +2.43.0 + diff --git a/python-requests.spec b/python-requests.spec index d4148fd06a280a69b0f6c27cd903b13187fc1a9d..56c19be99869fdc01983938fcce1a0f0a6f88f9b 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -1,14 +1,14 @@ %bcond_with tests Name: python-requests -Version: 2.27.1 +Version: 2.28.1 Release: 1 Summary: Python HTTP Library License: ASL 2.0 URL: http://python-requests.org/ Source0: https://github.com/psf/requests/archive/refs/tags/v%{version}.tar.gz -Patch6001: backport-requests-2.12.4-tests_nonet.patch +Patch6001: backport-use-localhost-ip-for-no-net.patch Patch6002: backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch Patch6003: backport-remove-tests-that-use-the-tarpit.patch @@ -95,6 +95,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v %doc HISTORY.md README.md %changelog +* Mon Apr 15 2024 Dongxing Wang - 2.28.1-1 +- Upgrade with version 2.28.1 to support Antelope + Start testing on 3.11 dev branch. + Wrap urllib3's SSLError as requests' SSLError. + Fix environment CA Bundle resolution. + * Thu Jun 16 2022 zhangying - 2.27.1-1 - Upgrade version for openstack yoga diff --git a/v2.27.1.tar.gz b/v2.28.1.tar.gz similarity index 63% rename from v2.27.1.tar.gz rename to v2.28.1.tar.gz index 631156ad7c8020706d929bb3283e107948ca11df..e2d367e20a3df9d3a2e025b24cad4cda32672b39 100644 Binary files a/v2.27.1.tar.gz and b/v2.28.1.tar.gz differ