diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd5961f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/requests-v2.20.0.tar.gz diff --git a/.python-requests.metadata b/.python-requests.metadata new file mode 100644 index 0000000..126ebb6 --- /dev/null +++ b/.python-requests.metadata @@ -0,0 +1 @@ +2c0728fc3aca17419b2b574341a0b019e117d4f5 SOURCES/requests-v2.20.0.tar.gz diff --git a/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch b/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch new file mode 100644 index 0000000..df24810 --- /dev/null +++ b/SOURCES/Don-t-inject-pyopenssl-into-urllib3.patch @@ -0,0 +1,38 @@ +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 new file mode 100644 index 0000000..3b1bcd6 --- /dev/null +++ b/SOURCES/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/SOURCES/Skip-all-tests-needing-httpbin.patch b/SOURCES/Skip-all-tests-needing-httpbin.patch new file mode 100644 index 0000000..363eff7 --- /dev/null +++ b/SOURCES/Skip-all-tests-needing-httpbin.patch @@ -0,0 +1,33 @@ +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 new file mode 100644 index 0000000..a3db03e --- /dev/null +++ b/SOURCES/patch-requests-certs.py-to-use-the-system-CA-bundle.patch @@ -0,0 +1,49 @@ +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 + +Signed-off-by: Jeremy Cline +--- + requests/certs.py | 11 ++++++++++- + setup.py | 1 - + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/requests/certs.py b/requests/certs.py +index d1a378d7..7b103baf 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()) +diff --git a/setup.py b/setup.py +index 4e2ad936..60de5861 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', +- 'certifi>=2017.4.17' + + ] + test_requirements = [ +-- +2.19.1 + diff --git a/SOURCES/requests-2.12.4-tests_nonet.patch b/SOURCES/requests-2.12.4-tests_nonet.patch new file mode 100644 index 0000000..5e097b1 --- /dev/null +++ b/SOURCES/requests-2.12.4-tests_nonet.patch @@ -0,0 +1,11 @@ +--- 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/SPECS/python-requests.spec b/SPECS/python-requests.spec new file mode 100644 index 0000000..3c980d3 --- /dev/null +++ b/SPECS/python-requests.spec @@ -0,0 +1,391 @@ +%if 0%{?_module_build} +# Don't run tests on module-build for now +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1450608 +%bcond_with tests +%else +# When bootstrapping Python, we cannot test this yet +%bcond_without tests +%endif + + +Name: python-requests +Version: 2.20.0 +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/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 + +# 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 + +# 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 + +BuildArch: noarch + +%description +Most existing Python modules for sending HTTP requests are extremely verbose and +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. + +%package -n python%{python3_pkgversion}-requests +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 +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-pytest-mock +%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 +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. + +%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 + +%build +%py3_build + + +%install +%py3_install + + +%if %{with tests} +%check +PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v +%endif # tests + +%files -n python%{python3_pkgversion}-requests +%license LICENSE +%doc README.md HISTORY.md +%{python3_sitelib}/*.egg-info +%{python3_sitelib}/requests/ + + +%changelog +* Mon Oct 29 2018 Jeremy Cline - 2.20.0-1 +- Update to v2.20.0 for CVE-2018-18074. + +* Wed Jul 11 2018 Petr Viktorin - 2.19.1-4 +- Remove the Python 2 subpackage + https://bugzilla.redhat.com/show_bug.cgi?id=1590396 + +* Thu Jun 21 2018 Lumír Balhar - 2.19.1-3 +- Allow build with Python 2 + +* Tue Jun 19 2018 Charalampos Stratakis - 2.19.1-2 +- Remove the python-pytest-cov dependency + +* Tue Jun 19 2018 Jeremy Cline - 2.19.1-1 +- Update to v2.19.1 (rhbz 1591531) + +* Tue Jun 19 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 + +* Tue Jun 12 2018 Tomas Orsava - 2.18.4-5 +- BR idna, or the tests fail to start + +* Mon Apr 16 2018 Jeremy Cline - 2.18.4-4 +- Stop injecting PyOpenSSL (rhbz 1567862) + +* Fri Feb 09 2018 Fedora Release Engineering - 2.18.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Dec 11 2017 Iryna Shcherbina - 2.18.4-2 +- Fix ambiguous Python 2 dependency declarations + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Aug 18 2017 Jeremy Cline - 2.18.4-1 +- Update to 2.18.4 + +* Wed Jul 26 2017 Igor Gnatenko - 2.18.2-1 +- Update to 2.18.2 + +* Tue Jun 20 2017 Jeremy Cline - 2.18.1-2 +- Drop the dependency on certifi in setup.py + +* 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 + +* Sun May 14 2017 Stephen Gallagher - 2.13.0-2 +- Don't run tests when building as a module + +* Thu Feb 09 2017 Jeremy Cline - 2.13.0-1 +- Update to 2.13.0 (#1418138) + +* Fri Dec 30 2016 Adam Williamson - 2.12.4-3 +- Include and enable tests (now python-pytest-httpbin is packaged) + +* Wed Dec 21 2016 Kevin Fenzi - 2.12.4-2 +- Rebuild for Python 3.6 again. + +* Tue Dec 20 2016 Jeremy Cline - 2.12.4-1 +- Update to 2.12.4. Fixes #1404680 + +* Tue Dec 13 2016 Stratakis Charalampos - 2.12.3-2 +- Rebuild for Python 3.6 + +* Thu Dec 01 2016 Jeremy Cline - 2.12.3-1 +- Update to 2.12.3. Fixes #1400601 + +* Wed Nov 30 2016 Jeremy Cline - 2.12.2-1 +- Update to 2.12.2 + +* Wed Nov 23 2016 Jeremy Cline - 2.12.1-2 +- Backport #3713. Fixes #1397149 + +* Thu Nov 17 2016 Jeremy Cline - 2.12.1-1 +- Update to 2.12.1. Fixes #1395469 +- Unbundle idna, a new upstream dependency + +* Sat Aug 27 2016 Kevin Fenzi - 2.11.1-1 +- Update to 2.11.1. Fixes #1370814 + +* Wed Aug 10 2016 Kevin Fenzi - 2.11.0-1 +- Update to 2.11.0. Fixes #1365332 + +* Tue Jul 19 2016 Fedora Release Engineering - 2.10.0-4 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Fri Jul 15 2016 Ralph Bean - 2.10.0-3 +- Update python2 packaging. + +* Thu Jun 02 2016 Ralph Bean - 2.10.0-2 +- Fix python2 subpackage to comply with guidelines. + +* Thu Feb 04 2016 Fedora Release Engineering - 2.9.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Mon Dec 21 2015 Ralph Bean - 2.9.1-1 +- new version + +* Fri Dec 18 2015 Ralph Bean - 2.9.0-1 +- new version + +* Mon Dec 14 2015 Ralph Bean - 2.8.1-1 +- Latest upstream. +- Bump hard dep on urllib3 to 1.12. + +* Mon Nov 02 2015 Robert Kuska - 2.7.0-8 +- Rebuilt for Python3.5 rebuild + +* Sat Oct 10 2015 Ralph Bean - 2.7.0-7 +- Tell setuptools about what version of urllib3 we're unbundling + for https://github.com/kennethreitz/requests/issues/2816 + +* Thu Sep 17 2015 Ralph Bean - 2.7.0-6 +- Replace the provides macro with a plain provides field for now until we can + re-organize this package into two different subpackages. + +* Thu Sep 17 2015 Ralph Bean - 2.7.0-5 +- Remove 'provides: python2-requests' from the python3 subpackage, obviously. + +* Tue Sep 15 2015 Ralph Bean - 2.7.0-4 +- Employ %%python_provides macro to provide python2-requests. + +* Fri Sep 04 2015 Ralph Bean - 2.7.0-3 +- Lock down the python-urllib3 version to the specific version we unbundled. + https://bugzilla.redhat.com/show_bug.cgi?id=1253823 + +* Thu Jun 18 2015 Fedora Release Engineering - 2.7.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon May 04 2015 Ralph Bean - 2.7.0-1 +- new version + +* Wed Apr 29 2015 Ralph Bean - 2.6.2-1 +- new version + +* Thu Apr 23 2015 Ralph Bean - 2.6.1-1 +- new version + +* Wed Apr 22 2015 Ralph Bean - 2.6.0-1 +- new version +- Remove patch for CVE-2015-2296, now included in the upstream release. + +* Mon Mar 16 2015 Ralph Bean - 2.5.3-2 +- Backport fix for CVE-2015-2296. + +* Thu Feb 26 2015 Ralph Bean - 2.5.3-1 +- new version + +* Wed Feb 18 2015 Ralph Bean - 2.5.1-1 +- new version + +* Tue Dec 16 2014 Ralph Bean - 2.5.0-3 +- Pin python-urllib3 requirement at 1.10. +- Fix requirement pinning syntax. + +* Thu Dec 11 2014 Ralph Bean - 2.5.0-2 +- Do the most basic of tests in the check section. + +* Thu Dec 11 2014 Ralph Bean - 2.5.0-1 +- Latest upstream, 2.5.0 for #1171068 + +* Wed Nov 05 2014 Ralph Bean - 2.4.3-1 +- Latest upstream, 2.4.3 for #1136283 + +* Wed Nov 05 2014 Ralph Bean - 2.3.0-4 +- Re-do unbundling by symlinking system libs into the requests/packages/ dir. + +* Sun Aug 3 2014 Tom Callaway - 2.3.0-3 +- fix license handling + +* Sat Jun 07 2014 Fedora Release Engineering - 2.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu May 29 2014 Arun S A G - 2.3.0-1 +- Latest upstream + +* Wed May 14 2014 Bohuslav Kabrda - 2.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 + +* Wed Sep 25 2013 Ralph Bean - 2.0.0-1 +- Latest upstream. +- Add doc macro to the python3 files section. +- Require python-urllib3 greater than or at 1.7.1. + +* Mon Aug 26 2013 Rex Dieter 1.2.3-5 +- fix versioned dep on python-urllib3 + +* Mon Aug 26 2013 Ralph Bean - 1.2.3-4 +- Explicitly versioned the requirements on python-urllib3. + +* Thu Aug 22 2013 Ralph Bean - 1.2.3-3 +- Release bump for a coupled update with python-urllib3. + +* Sun Aug 04 2013 Fedora Release Engineering - 1.2.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon Jul 01 2013 Ralph Bean - 1.2.3-1 +- Latest upstream. +- Fixed bogus date in changelog. + +* Tue Jun 11 2013 Ralph Bean - 1.1.0-4 +- Correct a rhel conditional on python-ordereddict + +* Thu Feb 28 2013 Ralph Bean - 1.1.0-3 +- Unbundled python-urllib3. Using system python-urllib3 now. +- Conditionally include python-ordereddict for el6. + +* Wed Feb 27 2013 Ralph Bean - 1.1.0-2 +- Unbundled python-charade/chardet. Using system python-chardet now. +- Removed deprecated comments and actions against oauthlib unbundling. + Those are no longer necessary in 1.1.0. +- Added links to bz tickets over Patch declarations. + +* Tue Feb 26 2013 Ralph Bean - 1.1.0-1 +- Latest upstream. +- Relicense to ASL 2.0 with upstream. +- Removed cookie handling patch (fixed in upstream tarball). +- Updated cert unbundling patch to match upstream. +- Added check section, but left it commented out for koji. + +* Fri Feb 8 2013 Toshio Kuratomi - 0.14.1-4 +- Let brp_python_bytecompile run again, take care of the non-python{2,3} modules + by removing them from the python{,3}-requests package that they did not belong + in. +- Use the certificates in the ca-certificates package instead of the bundled one + + https://bugzilla.redhat.com/show_bug.cgi?id=904614 +- Fix a problem with cookie handling + + https://bugzilla.redhat.com/show_bug.cgi?id=906924 + +* Mon Oct 22 2012 Arun S A G 0.14.1-1 +- Updated to latest upstream release + +* Sun Jun 10 2012 Arun S A G 0.13.1-1 +- Updated to latest upstream release 0.13.1 +- Use system provided ca-certificates +- No more async requests use grrequests https://github.com/kennethreitz/grequests +- Remove gevent as it is no longer required by requests + +* Sun Apr 01 2012 Arun S A G 0.11.1-1 +- Updated to upstream release 0.11.1 + +* Thu Mar 29 2012 Arun S A G 0.10.6-3 +- Support building package for EL6 + +* Tue Mar 27 2012 Rex Dieter 0.10.6-2 +- +python3-requests pkg + +* Sat Mar 3 2012 Arun SAG - 0.10.6-1 +- Updated to new upstream version + +* Sat Jan 21 2012 Arun SAG - 0.9.3-1 +- Updated to new upstream version 0.9.3 +- Include python-gevent as a dependency for requests.async +- Clean up shebangs in requests/setup.py,test_requests.py and test_requests_ext.py + +* Sat Jan 14 2012 Fedora Release Engineering - 0.8.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Sun Nov 27 2011 Arun SAG - 0.8.2-1 +- New upstream version +- keep alive support +- complete removal of cookiejar and urllib2 + +* Thu Nov 10 2011 Arun SAG - 0.7.6-1 +- Updated to new upstream release 0.7.6 + +* Thu Oct 20 2011 Arun SAG - 0.6.6-1 +- Updated to version 0.6.6 + +* Fri Aug 26 2011 Arun SAG - 0.6.1-1 +- Updated to version 0.6.1 + +* Sat Aug 20 2011 Arun SAG - 0.6.0-1 +- Updated to latest version 0.6.0 + +* Mon Aug 15 2011 Arun SAG - 0.5.1-2 +- Remove OPT_FLAGS from build section since it is a noarch package +- Fix use of mixed tabs and space +- Remove extra space around the word cumbersome in description + +* Sun Aug 14 2011 Arun SAG - 0.5.1-1 +- Initial package