From 6522c375f633f21dcced03f58ff43c87cee224ea Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 12 Jul 2022 14:20:31 -0700 Subject: [PATCH] Update to 2.28.1, rediff patches One patch replaced by a pytest -k arg (more maintainable this way). The charset_normalizer sed isn't needed any more (and didn't do anything any more), upstream changed that dep. Upstream dropped the cert file in 2017 so we don't need to try and remove it any more. --- .gitignore | 1 + Remove-tests-that-use-the-tarpit.patch | 55 ------------------- ...certs.py-to-use-the-system-CA-bundle.patch | 44 --------------- python-requests.spec | 25 ++++----- requests-2.12.4-tests_nonet.patch | 11 ---- requests-2.28.1-system-certs.patch | 37 +++++++++++++ requests-2.28.1-tests_nonet.patch | 11 ++++ sources | 2 +- 8 files changed, 60 insertions(+), 126 deletions(-) delete mode 100644 Remove-tests-that-use-the-tarpit.patch delete mode 100644 patch-requests-certs.py-to-use-the-system-CA-bundle.patch delete mode 100644 requests-2.12.4-tests_nonet.patch create mode 100644 requests-2.28.1-system-certs.patch create mode 100644 requests-2.28.1-tests_nonet.patch diff --git a/.gitignore b/.gitignore index 13dd352..0ccf83c 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ /requests-v2.26.0.tar.gz /requests-v2.27.0.tar.gz /requests-v2.27.1.tar.gz +/requests-v2.28.1.tar.gz diff --git a/Remove-tests-that-use-the-tarpit.patch b/Remove-tests-that-use-the-tarpit.patch deleted file mode 100644 index 682ab24..0000000 --- a/Remove-tests-that-use-the-tarpit.patch +++ /dev/null @@ -1,55 +0,0 @@ -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 ---- - tests/test_requests.py | 25 ------------------------- - 1 file changed, 25 deletions(-) - -diff --git a/tests/test_requests.py b/tests/test_requests.py -index 7d4a4eb5..8d1c55fc 100644 ---- a/tests/test_requests.py -+++ b/tests/test_requests.py -@@ -2186,31 +2186,6 @@ class TestTimeout: - 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""" - r = requests.request(b'GET', httpbin('get')) --- -2.24.1 - 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 deleted file mode 100644 index 62af510..0000000 --- a/patch-requests-certs.py-to-use-the-system-CA-bundle.patch +++ /dev/null @@ -1,44 +0,0 @@ -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 - ---- - requests/certs.py | 7 ++++++- - setup.py | 1 - - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/requests/certs.py b/requests/certs.py -index a14a7ee..b4957d1 100644 ---- a/requests/certs.py -+++ b/requests/certs.py -@@ -10,8 +10,13 @@ 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. -+ -+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 --git a/setup.py b/setup.py -index ce5e5c8..de86a91 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' - - ] - test_requirements = [ --- -2.31.1 - diff --git a/python-requests.spec b/python-requests.spec index e454808..d851ee3 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -9,8 +9,8 @@ Name: python-requests -Version: 2.27.1 -Release: 5%{?dist} +Version: 2.28.1 +Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 @@ -18,17 +18,14 @@ URL: https://pypi.io/project/requests Source0: https://github.com/requests/requests/archive/v%{version}/requests-v%{version}.tar.gz # Explicitly use the system certificates in ca-certificates. # https://bugzilla.redhat.com/show_bug.cgi?id=904614 -Patch0: patch-requests-certs.py-to-use-the-system-CA-bundle.patch - -# https://bugzilla.redhat.com/show_bug.cgi?id=1450608 -Patch2: Remove-tests-that-use-the-tarpit.patch +Patch0: requests-2.28.1-system-certs.patch # Use 127.0.0.1 not localhost for socket.bind() in the Server test # class, to fix tests in Koji's no-network environment # This probably isn't really upstreamable, because I guess localhost # could technically be IPv6 or something, and our no-network env is # a pretty odd one so this is a niche requirement. -Patch3: requests-2.12.4-tests_nonet.patch +Patch1: requests-2.28.1-tests_nonet.patch BuildArch: noarch @@ -73,20 +70,14 @@ designed to make HTTP requests easy for developers. %prep %autosetup -p1 -n requests-%{version} -# Unbundle the certificate bundle from mozilla. -rm -rf requests/cacert.pem - # env shebang in nonexecutable file sed -i '/#!\/usr\/.*python/d' requests/certs.py # Some doctests use the internet and fail to pass in Koji. Since doctests don't have names, I don't # know a way to skip them. We also don't want to patch them out, because patching them out will # change the docs. Thus, we set pytest not to run doctests at all. -sed -i 's/ --doctest-modules//' pytest.ini +sed -i 's/ --doctest-modules//' pyproject.toml -# Allow charset_normalizer 2.1.0 and newer up to 3.0.0 -# Backport of: https://github.com/psf/requests/pull/6169 -sed -i "s/charset_normalizer~=2.0.0/charset_normalizer~=2.0/" setup.py %build %pyproject_wheel @@ -99,7 +90,8 @@ sed -i "s/charset_normalizer~=2.0.0/charset_normalizer~=2.0/" setup.py %if %{with tests} %check -%pytest -v +# Omitted tests use a TARPIT server so require network connection +%pytest -v -k "not (test_connect_timeout or test_total_timeout_connect)" %endif @@ -109,6 +101,9 @@ sed -i "s/charset_normalizer~=2.0.0/charset_normalizer~=2.0/" setup.py %changelog +* Tue Jul 12 2022 Adam Williamson - 2.28.1-1 +- Update to 2.28.1, rediff patches + * Mon Jun 20 2022 Lumír Balhar - 2.27.1-5 - Allow charset_normalizer 2.1.0 and newer up to 3.0.0 diff --git a/requests-2.12.4-tests_nonet.patch b/requests-2.12.4-tests_nonet.patch deleted file mode 100644 index 5e097b1..0000000 --- a/requests-2.12.4-tests_nonet.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/requests-2.28.1-system-certs.patch b/requests-2.28.1-system-certs.patch new file mode 100644 index 0000000..58bd6b3 --- /dev/null +++ b/requests-2.28.1-system-certs.patch @@ -0,0 +1,37 @@ +--- requests-2.28.1/requests/certs.py 2022-07-12 13:55:25.378079641 -0700 ++++ requests-2.28.1/requests/certs.py.new 2022-07-12 13:57:03.834621295 -0700 +@@ -9,8 +9,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()) +--- requests-2.28.1/setup.py 2022-06-29 08:09:11.000000000 -0700 ++++ requests-2.28.1/setup.py.new 2022-07-12 13:58:33.830116402 -0700 +@@ -62,7 +62,6 @@ + "charset_normalizer>=2,<3", + "idna>=2.5,<4", + "urllib3>=1.21.1,<1.27", +- "certifi>=2017.4.17", + ] + test_requirements = [ + "pytest-httpbin==0.0.7", +--- requests-2.28.1/setup.cfg 2022-06-29 08:09:11.000000000 -0700 ++++ requests-2.28.1/setup.cfg.new 2022-07-12 13:58:19.619038220 -0700 +@@ -4,7 +4,6 @@ + socks + use_chardet_on_py3 + requires-dist = +- certifi>=2017.4.17 + charset_normalizer>=2,<3 + idna>=2.5,<4 + urllib3>=1.21.1,<1.27 diff --git a/requests-2.28.1-tests_nonet.patch b/requests-2.28.1-tests_nonet.patch new file mode 100644 index 0000000..32e96ee --- /dev/null +++ b/requests-2.28.1-tests_nonet.patch @@ -0,0 +1,11 @@ +--- requests-2.28.1/tests/testserver/server.py 2022-06-29 08:09:11.000000000 -0700 ++++ requests-2.28.1/tests/testserver/server.py.new 2022-07-12 14:04:30.218077055 -0700 +@@ -29,7 +29,7 @@ + def __init__( + self, + handler=None, +- host="localhost", ++ host="127.0.0.1", + port=0, + requests_to_handle=1, + wait_to_close_event=None, diff --git a/sources b/sources index d99f38d..6918890 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (requests-v2.27.1.tar.gz) = 191f8e0d566d541ab4e0c17bc9a637eb79e841605f6bbb9a0e559bd7bf0f00a71be99e21fa5b5431b9d49cb4a64debd0d7083658f98b723cf976833bb685cb9a +SHA512 (requests-v2.28.1.tar.gz) = caed2d08340c79af9448eefaa1df796f9112a7c8da30b218d5f342326a9629d95928c0978b9600e4bd7f56a297ef41afb088af390738be431b91b8c7429e741b