diff --git a/.python-requests.metadata b/.python-requests.metadata index 126ebb6..644da10 100644 --- a/.python-requests.metadata +++ b/.python-requests.metadata @@ -1 +1 @@ -2c0728fc3aca17419b2b574341a0b019e117d4f5 SOURCES/requests-v2.20.0.tar.gz +4f579210b12141af86ed9d8515763b69dbc84f78 SOURCES/requests-v2.26.0.tar.gz diff --git a/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch b/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch deleted file mode 100644 index df24810..0000000 --- a/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 86b1fa39fdebdb7bc57131c1a198d4d18e104f95 Mon Sep 17 00:00:00 2001 -From: Jeremy Cline -Date: Mon, 16 Apr 2018 10:35:35 -0400 -Subject: [PATCH] Don't inject pyopenssl into urllib3 - -Fedora ships sufficiently new versions of Python 2 and 3 to make this -unnecessary (rhbz 1567862) - -Signed-off-by: Jeremy Cline ---- - requests/__init__.py | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/requests/__init__.py b/requests/__init__.py -index a5b3c9c3..e312d314 100644 ---- a/requests/__init__.py -+++ b/requests/__init__.py -@@ -90,17 +90,6 @@ except (AssertionError, ValueError): - "version!".format(urllib3.__version__, chardet.__version__), - RequestsDependencyWarning) - --# Attempt to enable urllib3's SNI support, if possible --try: -- from urllib3.contrib import pyopenssl -- pyopenssl.inject_into_urllib3() -- -- # Check cryptography version -- from cryptography import __version__ as cryptography_version -- _check_cryptography(cryptography_version) --except ImportError: -- pass -- - # urllib3's DependencyWarnings should be silenced. - from urllib3.exceptions import DependencyWarning - warnings.simplefilter('ignore', DependencyWarning) --- -2.17.0 - diff --git a/SOURCES/Remove-tests-that-use-the-tarpit.patch b/SOURCES/Remove-tests-that-use-the-tarpit.patch index 3b1bcd6..682ab24 100644 --- a/SOURCES/Remove-tests-that-use-the-tarpit.patch +++ b/SOURCES/Remove-tests-that-use-the-tarpit.patch @@ -1,4 +1,4 @@ -From 524cd22fb77e69db9bb3f017bbb1d9782c37b0cd Mon Sep 17 00:00:00 2001 +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 @@ -15,10 +15,10 @@ Signed-off-by: Jeremy Cline 1 file changed, 25 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py -index b8350cb..46b7e9e 100755 +index 7d4a4eb5..8d1c55fc 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py -@@ -2049,31 +2049,6 @@ class TestTimeout: +@@ -2186,31 +2186,6 @@ class TestTimeout: except ReadTimeout: pass @@ -48,8 +48,8 @@ index b8350cb..46b7e9e 100755 - pass - def test_encoded_methods(self, httpbin): - """See: https://github.com/requests/requests/issues/2316""" + """See: https://github.com/psf/requests/issues/2316""" r = requests.request(b'GET', httpbin('get')) -- -2.9.4 +2.24.1 diff --git a/SOURCES/Skip-all-tests-needing-httpbin.patch b/SOURCES/Skip-all-tests-needing-httpbin.patch deleted file mode 100644 index 363eff7..0000000 --- a/SOURCES/Skip-all-tests-needing-httpbin.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 650da6c0267ba711d9d02d2bba8d79540437055f Mon Sep 17 00:00:00 2001 -From: Tomas Orsava -Date: Wed, 13 Jun 2018 15:44:42 +0200 -Subject: [PATCH] Skip all tests needing httpbin - -httpbin has too many dependencies to be shipped in RHEL just for -build-time package tests ---- - tests/conftest.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tests/conftest.py b/tests/conftest.py -index cd64a76..6cdc95a 100644 ---- a/tests/conftest.py -+++ b/tests/conftest.py -@@ -15,10 +15,12 @@ def prepare_url(value): - - - @pytest.fixture --def httpbin(httpbin): -+def httpbin(): -+ pytest.skip() - return prepare_url(httpbin) - - - @pytest.fixture --def httpbin_secure(httpbin_secure): -+def httpbin_secure(): -+ pytest.skip() - return prepare_url(httpbin_secure) --- -2.14.4 - diff --git a/SOURCES/patch-requests-certs.py-to-use-the-system-CA-bundle.patch b/SOURCES/patch-requests-certs.py-to-use-the-system-CA-bundle.patch index a3db03e..62af510 100644 --- a/SOURCES/patch-requests-certs.py-to-use-the-system-CA-bundle.patch +++ b/SOURCES/patch-requests-certs.py-to-use-the-system-CA-bundle.patch @@ -1,19 +1,18 @@ -From a8ef690988f92a56226f8b688f1a3638346bca8e Mon Sep 17 00:00:00 2001 -From: Jeremy Cline -Date: Mon, 19 Jun 2017 16:09:02 -0400 -Subject: [PATCH] Patch requests/certs.py to use the system CA bundle +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 -Signed-off-by: Jeremy Cline --- - requests/certs.py | 11 ++++++++++- - setup.py | 1 - - 2 files changed, 10 insertions(+), 2 deletions(-) + 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 d1a378d7..7b103baf 100644 +index a14a7ee..b4957d1 100644 --- a/requests/certs.py +++ b/requests/certs.py -@@ -11,8 +11,17 @@ only one — the one from the certifi package. +@@ -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. @@ -22,28 +21,24 @@ index d1a378d7..7b103baf 100644 +by the ca-certificates RPM package. """ -from certifi import where -+try: -+ from certifi import where -+except ImportError: -+ def where(): -+ """Return the absolute path to the system CA bundle.""" -+ return '/etc/pki/tls/certs/ca-bundle.crt' -+ ++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 4e2ad936..60de5861 100755 +index ce5e5c8..de86a91 100755 --- a/setup.py +++ b/setup.py -@@ -45,7 +45,6 @@ requires = [ - 'chardet>=3.0.2,<3.1.0', - 'idna>=2.5,<2.8', - 'urllib3>=1.21.1,<1.25', +@@ -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.19.1 +2.31.1 diff --git a/SOURCES/properly-handle-default-ports-in-auth-stripping.patch b/SOURCES/properly-handle-default-ports-in-auth-stripping.patch deleted file mode 100644 index f99d3ca..0000000 --- a/SOURCES/properly-handle-default-ports-in-auth-stripping.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff --git a/requests/sessions.py b/requests/sessions.py -index a448bd8..d73d700 100644 ---- a/requests/sessions.py -+++ b/requests/sessions.py -@@ -19,7 +19,7 @@ from .cookies import ( - from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT - from .hooks import default_hooks, dispatch_hook - from ._internal_utils import to_native_string --from .utils import to_key_val_list, default_headers -+from .utils import to_key_val_list, default_headers, DEFAULT_PORTS - from .exceptions import ( - TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError) - -@@ -128,8 +128,17 @@ class SessionRedirectMixin(object): - if (old_parsed.scheme == 'http' and old_parsed.port in (80, None) - and new_parsed.scheme == 'https' and new_parsed.port in (443, None)): - return False -+ -+ # Handle default port usage corresponding to scheme. -+ changed_port = old_parsed.port != new_parsed.port -+ changed_scheme = old_parsed.scheme != new_parsed.scheme -+ default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) -+ if (not changed_scheme and old_parsed.port in default_port -+ and new_parsed.port in default_port): -+ return False -+ - # Standard case: root URI must match -- return old_parsed.port != new_parsed.port or old_parsed.scheme != new_parsed.scheme -+ return changed_port or changed_scheme - - def resolve_redirects(self, resp, req, stream=False, timeout=None, - verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs): -diff --git a/requests/utils.py b/requests/utils.py -index 0ce7fe1..04145c8 100644 ---- a/requests/utils.py -+++ b/requests/utils.py -@@ -38,6 +38,8 @@ NETRC_FILES = ('.netrc', '_netrc') - - DEFAULT_CA_BUNDLE_PATH = certs.where() - -+DEFAULT_PORTS = {'http': 80, 'https': 443} -+ - - if sys.platform == 'win32': - # provide a proxy_bypass version on Windows without DNS lookups -diff --git a/tests/test_requests.py b/tests/test_requests.py -index f46561e..f99fdaf 100644 ---- a/tests/test_requests.py -+++ b/tests/test_requests.py -@@ -1611,6 +1611,17 @@ class TestRequests: - s = requests.Session() - assert s.should_strip_auth('http://example.com:1234/foo', 'https://example.com:4321/bar') - -+ @pytest.mark.parametrize( -+ 'old_uri, new_uri', ( -+ ('https://example.com:443/foo', 'https://example.com/bar'), -+ ('http://example.com:80/foo', 'http://example.com/bar'), -+ ('https://example.com/foo', 'https://example.com:443/bar'), -+ ('http://example.com/foo', 'http://example.com:80/bar') -+ )) -+ def test_should_strip_auth_default_port(self, old_uri, new_uri): -+ s = requests.Session() -+ assert not s.should_strip_auth(old_uri, new_uri) -+ - def test_manual_redirect_with_partial_body_read(self, httpbin): - s = requests.Session() - r1 = s.get(httpbin('redirect/2'), allow_redirects=False, stream=True) diff --git a/SPECS/python-requests.spec b/SPECS/python-requests.spec index b475e64..2ba419c 100644 --- a/SPECS/python-requests.spec +++ b/SPECS/python-requests.spec @@ -9,8 +9,8 @@ Name: python-requests -Version: 2.20.0 -Release: 2.1%{?dist} +Version: 2.26.0 +Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 @@ -30,20 +30,6 @@ Patch2: Remove-tests-that-use-the-tarpit.patch # a pretty odd one so this is a niche requirement. Patch3: requests-2.12.4-tests_nonet.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=1567862 -Patch4: Don-t-inject-pyopenssl-into-urllib3.patch - -# Skip all tests needing httpbin -# httpbin has too many dependencies to be shipped in RHEL just for -# build-time package tests -Patch5: Skip-all-tests-needing-httpbin.patch - -# Properly handle default ports when stripping the authorization header. -# This fixes a regression introduced with fixing CVE-2018-18074. -# Fixed upstream: https://github.com/psf/requests/pull/4851 -# Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1758261 -Patch6: properly-handle-default-ports-in-auth-stripping.patch - BuildArch: noarch %description @@ -58,17 +44,15 @@ Summary: HTTP library, written in Python, for human beings %{?python_provide:%python_provide python%{python3_pkgversion}-requests} BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-chardet -BuildRequires: python%{python3_pkgversion}-urllib3 -BuildRequires: python%{python3_pkgversion}-idna +BuildRequires: pyproject-rpm-macros + %if %{with tests} -BuildRequires: python%{python3_pkgversion}-pytest -BuildRequires: python%{python3_pkgversion}-pytest-mock +BuildRequires: python3dist(pytest) +BuildRequires: python3dist(pytest-httpbin) +BuildRequires: python3dist(pytest-mock) +BuildRequires: python3dist(trustme) %endif -Requires: python%{python3_pkgversion}-chardet -Requires: python%{python3_pkgversion}-urllib3 -Requires: python%{python3_pkgversion}-idna %description -n python%{python3_pkgversion}-requests Most existing Python modules for sending HTTP requests are extremely verbose and @@ -76,6 +60,16 @@ cumbersome. Python’s built-in urllib2 module provides most of the HTTP capabilities you should need, but the API is thoroughly broken. This library is designed to make HTTP requests easy for developers. +%pyproject_extras_subpkg -n python%{python3_pkgversion}-requests security socks + +%generate_buildrequires +%if %{with tests} +%pyproject_buildrequires -r +%else +%pyproject_buildrequires +%endif + + %prep %autosetup -p1 -n requests-%{version} @@ -85,60 +79,147 @@ 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 + %build -%py3_build +%pyproject_wheel %install -%py3_install +%pyproject_install +%pyproject_save_files requests %if %{with tests} %check -PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v -%endif # tests +# test_https_warnings: https://github.com/psf/requests/issues/5530 +# test_pyopenssl_redirect fails with: pytest-httpbin server hit +# an exception serving request: [SSL: HTTP_REQUEST] http request (_ssl.c:997) +# not yet sure why +%pytest -v -k "not test_https_warnings and not test_pyopenssl_redirect" +%endif + -%files -n python%{python3_pkgversion}-requests +%files -n python%{python3_pkgversion}-requests -f %{pyproject_files} %license LICENSE %doc README.md HISTORY.md -%{python3_sitelib}/*.egg-info -%{python3_sitelib}/requests/ %changelog -* Thu Oct 17 2019 Tomas Orsava - 2.20.0-2.1 -- Bumping to enable gating -Related: rhbz#1758261 +* Sun Jul 25 2021 Lumír Balhar - 2.26.0-1 +- Update to 2.26.0 +Resolves: rhbz#1981856 -* Mon Oct 14 2019 Charalampos Stratakis - 2.20.0-2 -- Properly handle default ports when stripping the authorization header -Resolves: rhbz#1758261 +* Fri Jul 23 2021 Fedora Release Engineering - 2.25.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild -* Mon Oct 29 2018 Jeremy Cline - 2.20.0-1 -- Update to v2.20.0 for CVE-2018-18074. +* Fri Jun 04 2021 Python Maint - 2.25.1-3 +- Rebuilt for Python 3.10 + +* Wed Jun 02 2021 Python Maint - 2.25.1-2 +- Bootstrap for Python 3.10 + +* Tue Feb 02 2021 Kevin Fenzi - 2.25.1-1 +- Update 2.25.1. Fix is rhbz#1908487 + +* Wed Jan 27 2021 Fedora Release Engineering - 2.25.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Nov 25 2020 Petr Viktorin - 2.25.0-1 +- Update to 2.25.0 + +* Fri Nov 13 2020 Miro Hrončok - 2.24.0-5 +- Don't BR pytest-cov + +* Fri Sep 18 2020 Petr Viktorin - 2.24.0-4 +- Port to pyproject macros + +* Fri Sep 18 2020 Miro Hrončok - 2.24.0-3 +- Build with pytest 6, older version is no longer required -* Wed Jul 11 2018 Petr Viktorin - 2.19.1-4 -- Remove the Python 2 subpackage - https://bugzilla.redhat.com/show_bug.cgi?id=1590396 +* Wed Jul 29 2020 Fedora Release Engineering - 2.24.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild -* Thu Jun 21 2018 Lumír Balhar - 2.19.1-3 -- Allow build with Python 2 +* Fri Jul 10 2020 Miro Hrončok - 2.24.0-1 +- Update to 2.24.0 +- Resolves rhbz#1848104 -* Tue Jun 19 2018 Charalampos Stratakis - 2.19.1-2 -- Remove the python-pytest-cov dependency +* Fri Jul 10 2020 Miro Hrončok - 2.23.0-5 +- Add requests[security] and requests[socks] subpackages -* Tue Jun 19 2018 Jeremy Cline - 2.19.1-1 +* Sat May 30 2020 Miro Hrončok - 2.23.0-4 +- Test with pytest 4, drop manual requires + +* Mon May 25 2020 Miro Hrončok - 2.23.0-3 +- Rebuilt for Python 3.9 + +* Fri May 22 2020 Miro Hrončok - 2.23.0-2 +- Bootstrap for Python 3.9 + +* Fri Feb 21 2020 Randy Barlow - 2.23.0-1 +- Update to 2.23.0 (#1804863). +- https://requests.readthedocs.io/en/latest/community/updates/ + +* Thu Jan 30 2020 Fedora Release Engineering - 2.22.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Oct 22 2019 Charalampos Stratakis - 2.22.0-7 +- Remove the python2 subpackage (rhbz#1761787) + +* Wed Sep 18 2019 Petr Viktorin - 2.22.0-6 +- Python 2: Remove tests and test dependencies + +* Mon Aug 19 2019 Miro Hrončok - 2.22.0-5 +- Rebuilt for Python 3.8 + +* Thu Aug 15 2019 Miro Hrončok - 2.22.0-4 +- Bootstrap for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 2.22.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jun 11 2019 Yatin Karel - 2.22.0-2 +- Add minimum requirement for chardet and urllib3 + +* Thu May 23 2019 Jeremy Cline - 2.22.0-1 +- Update to v2.22.0 + +* Sat Feb 02 2019 Fedora Release Engineering - 2.21.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Dec 13 2018 Jeremy Cline - 2.21.0-1 +- Update to v2.21.0 +- Don't rely on certifi being patched properly to use the system CA bundle + +* Mon Nov 26 2018 Miro Hrončok - 2.20.0-2 +- No pytest-httpbin for Python 2 + +* Mon Oct 29 2018 Jeremy Cline - 2.20.0-1 +- Update to v2.20.0 + +* Sat Jul 14 2018 Fedora Release Engineering - 2.19.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jun 18 2018 Miro Hrončok - 2.19.1-2 +- Rebuilt for Python 3.7 + +* Thu Jun 14 2018 Jeremy Cline - 2.19.1-1 - Update to v2.19.1 (rhbz 1591531) -* Tue Jun 19 2018 Jeremy Cline - 2.19.0-1 +* Thu Jun 14 2018 Miro Hrončok - 2.19.0-2 +- Bootstrap for Python 3.7 + +* Tue Jun 12 2018 Jeremy Cline - 2.19.0-1 - Update to v2.19.0 (rhbz 1590508) -* Wed Jun 13 2018 Tomas Orsava - 2.18.4-6 -- Skip all tests needing httpbin: httpbin has too many dependencies to be - shipped in RHEL just for build-time package tests +* Fri Jun 08 2018 Jeremy Cline - 2.18.4-6 +- Don't print runtime warning about urllib3 v1.23 (rhbz 1589306) -* Tue Jun 12 2018 Tomas Orsava - 2.18.4-5 -- BR idna, or the tests fail to start +* Tue Jun 05 2018 Jeremy Cline - 2.18.4-5 +- Allow urllib3 v1.23 (rhbz 1586311) * Mon Apr 16 2018 Jeremy Cline - 2.18.4-4 - Stop injecting PyOpenSSL (rhbz 1567862)