diff --git a/.gitignore b/.gitignore index 45f6d88..fb7e44e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ /requests-2.12.4-tests.tar.gz /requests-v2.13.0.tar.gz /requests-v2.14.2.tar.gz +/requests-v2.18.1.tar.gz diff --git a/Remove-tests-that-use-the-tarpit.patch b/Remove-tests-that-use-the-tarpit.patch new file mode 100644 index 0000000..3b1bcd6 --- /dev/null +++ b/Remove-tests-that-use-the-tarpit.patch @@ -0,0 +1,55 @@ +From 524cd22fb77e69db9bb3f017bbb1d9782c37b0cd 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 b8350cb..46b7e9e 100755 +--- a/tests/test_requests.py ++++ b/tests/test_requests.py +@@ -2049,31 +2049,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/requests/requests/issues/2316""" + r = requests.request(b'GET', httpbin('get')) +-- +2.9.4 + diff --git a/dont-import-OrderedDict-from-urllib3.patch b/dont-import-OrderedDict-from-urllib3.patch new file mode 100644 index 0000000..0b0279c --- /dev/null +++ b/dont-import-OrderedDict-from-urllib3.patch @@ -0,0 +1,29 @@ +From 75f027ac8bc55ad280f7bf72a25db1ce8c1fc76d Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Mon, 19 Jun 2017 16:19:53 -0400 +Subject: [PATCH] Don't import OrderedDict from urllib3 + +Signed-off-by: Jeremy Cline +--- + requests/compat.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/requests/compat.py b/requests/compat.py +index 5c09ea8..61fa0c8 100644 +--- a/requests/compat.py ++++ b/requests/compat.py +@@ -46,7 +46,10 @@ if is_py2: + from Cookie import Morsel + from StringIO import StringIO + +- from urllib3.packages.ordered_dict import OrderedDict ++ try: ++ from collections import OrderedDict # py2.7+ ++ except: ++ from ordereddict import OrderedDict # py2.6 and lower (el6, etc. + + builtin_str = str + bytes = str +-- +2.9.4 + 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..1e06ead --- /dev/null +++ b/patch-requests-certs.py-to-use-the-system-CA-bundle.patch @@ -0,0 +1,36 @@ +From 5bce3f425c5bd59dccdd054f7f27baceb3cf3fb4 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 + +Signed-off-by: Jeremy Cline +--- + requests/certs.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/requests/certs.py b/requests/certs.py +index d1a378d..7b103ba 100644 +--- a/requests/certs.py ++++ b/requests/certs.py +@@ -11,8 +11,17 @@ 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 ++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' ++ + + if __name__ == '__main__': + print(where()) +-- +2.9.4 + diff --git a/python-requests-remove-nested-bundling-dep.patch b/python-requests-remove-nested-bundling-dep.patch deleted file mode 100644 index d915a4e..0000000 --- a/python-requests-remove-nested-bundling-dep.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8c2259d4ab03ef982738aaf863068a1015cadf3d Mon Sep 17 00:00:00 2001 -From: Ralph Bean -Date: Wed, 5 Nov 2014 10:23:44 -0500 -Subject: [PATCH] Remove nested bundling dep. - ---- - requests/compat.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/requests/compat.py b/requests/compat.py -index be5a1ed..70ea4e8 100644 ---- a/requests/compat.py -+++ b/requests/compat.py -@@ -91,7 +91,11 @@ if is_py2: - import cookielib - from Cookie import Morsel - from StringIO import StringIO -- from .packages.urllib3.packages.ordered_dict import OrderedDict -+ -+ try: -+ from collections import OrderedDict # py2.7 -+ except: -+ from ordereddict import OrderedDict # py2.6 and lower (el6, etc.) - - builtin_str = str - bytes = str --- -1.9.3 - diff --git a/python-requests-system-cert-bundle.patch b/python-requests-system-cert-bundle.patch deleted file mode 100644 index e76b741..0000000 --- a/python-requests-system-cert-bundle.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a49b39fbfe01791880c6e7179f6efdad03e8ce58 Mon Sep 17 00:00:00 2001 -From: Ralph Bean -Date: Wed, 5 Nov 2014 10:15:17 -0500 -Subject: [PATCH] system cert bundle - ---- - requests/certs.py | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/requests/certs.py b/requests/certs.py -index 07e6475..2c7ca96 100644 ---- a/requests/certs.py -+++ b/requests/certs.py -@@ -10,16 +10,17 @@ This module returns the preferred default CA certificate bundle. - 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. -+ -+We return "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates -+package. - """ --import os.path - - try: - from certifi import where - except ImportError: - def where(): -- """Return the preferred certificate bundle.""" -- # vendored bundle inside Requests -- return os.path.join(os.path.dirname(__file__), 'cacert.pem') -+ """ Don't use the certs bundled with requests, use ca-certificates. """ -+ return "/etc/pki/tls/certs/ca-bundle.crt" - - if __name__ == '__main__': - print(where()) --- -1.9.3 - diff --git a/python-requests-urllib3-at-1.21.1.patch b/python-requests-urllib3-at-1.21.1.patch deleted file mode 100644 index fb44c99..0000000 --- a/python-requests-urllib3-at-1.21.1.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e44b99214a953fcc68227a7182f2fecd55c58267 Mon Sep 17 00:00:00 2001 -From: Jeremy Cline -Date: Wed, 17 May 2017 11:57:23 -0400 -Subject: [PATCH] python requests urllib3 at 1.21.1 - -Signed-off-by: Jeremy Cline ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 6ad0bc3..50ae1a1 100755 ---- a/setup.py -+++ b/setup.py -@@ -48,7 +48,7 @@ packages = [ - 'requests.packages.urllib3.contrib._securetransport', - ] - --requires = [] -+requires = ['urllib3==1.21.1'] - test_requirements = ['pytest>=2.8.0', 'pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock'] - - with open('requests/__init__.py', 'r') as fd: --- -2.9.4 - diff --git a/python-requests.spec b/python-requests.spec index 093e3b8..8c9a42f 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -7,30 +7,28 @@ %{!?python3_pkgversion: %global python3_pkgversion 34} %endif -%global urllib3_unbundled_version 1.21.1 - Name: python-requests -Version: 2.14.2 +Version: 2.18.1 Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 URL: https://pypi.io/project/requests -Source0: https://github.com/kennethreitz/requests/archive/v%{version}/requests-v%{version}.tar.gz +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: python-requests-system-cert-bundle.patch +Patch0: patch-requests-certs.py-to-use-the-system-CA-bundle.patch # Remove an unnecessary reference to a bundled compat lib in urllib3 # Some discussion with upstream: # - https://twitter.com/sigmavirus24/status/529816751651819520 # - https://github.com/kennethreitz/requests/issues/1811 # - https://github.com/kennethreitz/requests/pull/1812 -Patch1: python-requests-remove-nested-bundling-dep.patch +Patch1: dont-import-OrderedDict-from-urllib3.patch + -# Tell setuptools about what version of urllib3 we're unbundling -# - https://github.com/kennethreitz/requests/issues/2816 -Patch2: python-requests-urllib3-at-%{urllib3_unbundled_version}.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1450608 +Patch2: Remove-tests-that-use-the-tarpit.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 @@ -53,7 +51,7 @@ Summary: HTTP library, written in Python, for human beings BuildRequires: python2-devel BuildRequires: python-chardet -BuildRequires: python2-urllib3 == %{urllib3_unbundled_version} +BuildRequires: python2-urllib3 # For tests BuildRequires: python2-pytest BuildRequires: python2-pytest-cov @@ -63,7 +61,7 @@ BuildRequires: python2-pytest-mock Requires: ca-certificates Requires: python-chardet -Requires: python2-urllib3 == %{urllib3_unbundled_version} +Requires: python2-urllib3 Requires: python-idna %if 0%{?rhel} && 0%{?rhel} <= 6 @@ -85,7 +83,7 @@ Summary: HTTP library, written in Python, for human beings BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-chardet -BuildRequires: python%{python3_pkgversion}-urllib3 == %{urllib3_unbundled_version} +BuildRequires: python%{python3_pkgversion}-urllib3 # For tests BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-pytest-cov @@ -93,7 +91,7 @@ BuildRequires: python%{python3_pkgversion}-pytest-httpbin BuildRequires: python%{python3_pkgversion}-pytest-mock Requires: python%{python3_pkgversion}-chardet -Requires: python%{python3_pkgversion}-urllib3 == %{urllib3_unbundled_version} +Requires: python%{python3_pkgversion}-urllib3 Requires: python%{python3_pkgversion}-idna %description -n python%{python3_pkgversion}-requests @@ -119,36 +117,21 @@ cp -a . %{py3dir} pushd %{py3dir} %{__python3} setup.py build -# Unbundle chardet and urllib3. We replace these with symlinks to system libs. -rm -rf build/lib/requests/packages/chardet -rm -rf build/lib/requests/packages/urllib3 -rm -rf build/lib/requests/packages/idna - popd %endif %{__python} setup.py build -# Unbundle chardet and urllib3. We replace these with symlinks to system libs. -rm -rf build/lib/requests/packages/chardet -rm -rf build/lib/requests/packages/urllib3 -rm -rf build/lib/requests/packages/idna %install rm -rf $RPM_BUILD_ROOT %if 0%{?_with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT -ln -s ../../chardet %{buildroot}/%{python3_sitelib}/requests/packages/chardet -ln -s ../../urllib3 %{buildroot}/%{python3_sitelib}/requests/packages/urllib3 -ln -s ../../idna %{buildroot}/%{python3_sitelib}/requests/packages/idna popd %endif %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT -ln -s ../../chardet %{buildroot}/%{python2_sitelib}/requests/packages/chardet -ln -s ../../urllib3 %{buildroot}/%{python2_sitelib}/requests/packages/urllib3 -ln -s ../../idna %{buildroot}/%{python2_sitelib}/requests/packages/idna %check @@ -168,7 +151,7 @@ popd %defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE -%doc NOTICE README.rst HISTORY.rst +%doc README.rst HISTORY.rst %{python2_sitelib}/*.egg-info %dir %{python2_sitelib}/requests %{python2_sitelib}/requests/* @@ -177,12 +160,16 @@ popd %files -n python%{python3_pkgversion}-requests %{!?_licensedir:%global license %%doc} %license LICENSE -%doc NOTICE README.rst HISTORY.rst +%doc README.rst HISTORY.rst %{python3_sitelib}/*.egg-info %{python3_sitelib}/requests/ %endif %changelog +* Mon Jun 19 2017 Jeremy Cline - 2.18.1-1 +- Update to 2.18.1 (#1449432) +- Remove tests that require non-local network (#1450608) + * Wed May 17 2017 Jeremy Cline - 2.14.2-1 - Update to 2.14.2 (#1449432) - Switch to autosetup to apply patches diff --git a/sources b/sources index 58b0080..e8af340 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (requests-v2.14.2.tar.gz) = a9f2b612bbfc4ce27c9a96bfac052f01329f2adbde7f188ee5507419f73252f282ebe68616df93a8c32680998c85ee7adf683893801df24439de8f0ed02af0a2 +SHA512 (requests-v2.18.1.tar.gz) = a80e0487b4b729e69522817bc2eec2a9c5f1df34df385581b3e937c2409e0fcb4e1f9b4794b198c8b8a57fc05b1bc513fc70d41b324ae251de0fa9bc7c9e6947