From 74db89b32895cb7f543f37811f736e402c98dfe7 Mon Sep 17 00:00:00 2001 From: Arun SAG Date: Sun, 10 Jun 2012 22:47:44 +0530 Subject: [PATCH 01/10] Updated to 0.13.1 --- .gitignore | 1 + python-requests.spec | 19 +++++++++++-------- sources | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index d4527b5..efd9e4f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /requests-0.9.3.tar.gz /requests-0.10.6.tar.gz /requests-0.11.1.tar.gz +/requests-0.13.1.tar.gz diff --git a/python-requests.spec b/python-requests.spec index 0337734..aa9afd4 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -5,8 +5,8 @@ %endif Name: python-requests -Version: 0.11.1 -Release: 2%{?dist} +Version: 0.13.1 +Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT @@ -16,10 +16,7 @@ Source0: http://pypi.python.org/packages/source/r/requests/requests-%{ver BuildArch: noarch BuildRequires: python-devel -Requires: python-certifi -%if 0%{?fedora} -Requires: python-gevent -%endif +Requires: ca-certificates %description Most existing Python modules for sending HTTP requests are extremely verbose and @@ -31,11 +28,14 @@ designed to make HTTP requests easy for developers. %package -n python3-requests Summary: HTTP library, written in Python, for human beings BuildRequires: python3-devel +Requires: python3-chardet %description -n python3-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. +%else +Requires: python-chardet %endif @@ -72,8 +72,11 @@ rm -rf $RPM_BUILD_ROOT %changelog -* Sun Apr 08 2012 Arun S A G 0.11.1-2 -- Requires python-certifi for https processing +* 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 diff --git a/sources b/sources index 35b2373..6704a5e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c903c32a0e1f04889e693da8e9c71872 requests-0.11.1.tar.gz +31a08091feeefe60817e45122d933219 requests-0.13.1.tar.gz From f0e2277d8b111517ccf1a7090b783cc95b8001e4 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 21 Jul 2012 03:20:12 -0500 Subject: [PATCH 02/10] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- python-requests.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-requests.spec b/python-requests.spec index aa9afd4..ec7b7a4 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -6,7 +6,7 @@ Name: python-requests Version: 0.13.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT @@ -72,6 +72,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Jul 21 2012 Fedora Release Engineering - 0.13.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * 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 From 94278d4bf91c4fe31aacec9bb79b50a6cd444d2d Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sat, 4 Aug 2012 01:09:00 -0400 Subject: [PATCH 03/10] rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 --- python-requests.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-requests.spec b/python-requests.spec index ec7b7a4..473fb3d 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -6,7 +6,7 @@ Name: python-requests Version: 0.13.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT @@ -72,6 +72,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Aug 04 2012 David Malcolm - 0.13.1-3 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + * Sat Jul 21 2012 Fedora Release Engineering - 0.13.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From e9f9b2b5c01b1fec12f7bc2c2214333c9ca07304 Mon Sep 17 00:00:00 2001 From: Arun SAG Date: Thu, 25 Oct 2012 01:06:30 +0530 Subject: [PATCH 04/10] Updated to requests 0.14.1 --- .gitignore | 1 + python-requests.spec | 36 +++++++++++++++++++----------------- sources | 2 +- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index efd9e4f..321be65 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /requests-0.10.6.tar.gz /requests-0.11.1.tar.gz /requests-0.13.1.tar.gz +/requests-0.14.1.tar.gz diff --git a/python-requests.spec b/python-requests.spec index 473fb3d..bb7e940 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -3,10 +3,11 @@ %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif - +# Turn off the brp-python-bytecompile script +#%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') Name: python-requests -Version: 0.13.1 -Release: 3%{?dist} +Version: 0.14.1 +Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT @@ -14,7 +15,7 @@ URL: http://pypi.python.org/pypi/requests Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz BuildArch: noarch -BuildRequires: python-devel +BuildRequires: python2-devel Requires: ca-certificates @@ -28,14 +29,11 @@ designed to make HTTP requests easy for developers. %package -n python3-requests Summary: HTTP library, written in Python, for human beings BuildRequires: python3-devel -Requires: python3-chardet %description -n python3-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. -%else -Requires: python-chardet %endif @@ -43,20 +41,27 @@ Requires: python-chardet %setup -q -n requests-%{version} %build -%{__python} setup.py build %if 0%{?_with_python3} %{__python3} setup.py build %endif - +%{__python} setup.py build %install rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %if 0%{?_with_python3} -%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +PYTHONDONTWRITEBYTECODE=1 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/chardet2 +#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/oauthlib +#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/urllib3 +#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/*.py %endif - +PYTHONDONTWRITEBYTECODE=1 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/chardet +#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/oauthlib +#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/urllib3 +#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/*.py +# %files %defattr(-,root,root,-) %doc NOTICE LICENSE README.rst HISTORY.rst @@ -72,11 +77,8 @@ rm -rf $RPM_BUILD_ROOT %changelog -* Sat Aug 04 2012 David Malcolm - 0.13.1-3 -- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 - -* Sat Jul 21 2012 Fedora Release Engineering - 0.13.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild +* Wed 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 diff --git a/sources b/sources index 6704a5e..611d373 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -31a08091feeefe60817e45122d933219 requests-0.13.1.tar.gz +3de30600072cbc7214ae342d1d08aa46 requests-0.14.1.tar.gz From ad439987b8e3e9318eb645a566a8778a67baa9ef Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 8 Feb 2013 12:36:37 -0800 Subject: [PATCH 05/10] 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 --- python-requests-cookie-handling.patch | 35 +++++++++++ python-requests-system-cert-bundle.patch | 16 +++++ python-requests.spec | 76 +++++++++++++++++++----- 3 files changed, 111 insertions(+), 16 deletions(-) create mode 100644 python-requests-cookie-handling.patch create mode 100644 python-requests-system-cert-bundle.patch diff --git a/python-requests-cookie-handling.patch b/python-requests-cookie-handling.patch new file mode 100644 index 0000000..520dea4 --- /dev/null +++ b/python-requests-cookie-handling.patch @@ -0,0 +1,35 @@ +From 2cecc4bc828fc1754cc26f279ec3ff5cd65cb8f7 Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Thu, 31 Jan 2013 21:38:58 -0500 +Subject: [PATCH] cookie handling + +--- + requests/models.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/requests/models.py b/requests/models.py +index 2193c6e..0a12237 100644 +--- a/requests/models.py ++++ b/requests/models.py +@@ -17,7 +17,7 @@ from .structures import CaseInsensitiveDict + from .status_codes import codes + + from .auth import HTTPBasicAuth, HTTPProxyAuth +-from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header ++from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header, RequestsCookieJar + from .packages.urllib3.exceptions import MaxRetryError, LocationParseError + from .packages.urllib3.exceptions import TimeoutError + from .packages.urllib3.exceptions import SSLError as _SSLError +@@ -207,7 +207,8 @@ class Request(object): + extract_cookies_to_jar(self.cookies, self, resp) + + # Save cookies in Response. +- response.cookies = self.cookies ++ response.cookies = RequestsCookieJar() ++ extract_cookies_to_jar(response.cookies, self, resp) + + # Save cookies in Session. + for cookie in self.cookies: +-- +1.8.1 + diff --git a/python-requests-system-cert-bundle.patch b/python-requests-system-cert-bundle.patch new file mode 100644 index 0000000..198e4c2 --- /dev/null +++ b/python-requests-system-cert-bundle.patch @@ -0,0 +1,16 @@ +Index: requests-0.14.1/requests/certs.py +=================================================================== +--- requests-0.14.1.orig/requests/certs.py ++++ requests-0.14.1/requests/certs.py +@@ -21,7 +21,10 @@ def where(): + return certifi.where() + else: + f = os.path.split(__file__)[0] +- return os.path.join(f, 'cacert.pem') ++ path = os.path.join(f, 'cacert.pem') ++ if os.path.exists(path): ++ return path ++ return None + + if __name__ == '__main__': + print(where()) diff --git a/python-requests.spec b/python-requests.spec index bb7e940..7771692 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -1,19 +1,23 @@ -%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%if 0%{?fedora} %global _with_python3 1 %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif -# Turn off the brp-python-bytecompile script -#%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') Name: python-requests Version: 0.14.1 -Release: 1%{?dist} +Release: 4%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT URL: http://pypi.python.org/pypi/requests Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz - +# Separate response cookies from request cookies discussed here: +# https://github.com/fedora-infra/python-fedora/pull/6 +Patch0: python-requests-cookie-handling.patch +# Use the system certificates in ca-certificates. This patch causes util.py +# to search for the system bundle (whereas now the return value of +# certs.where() causes it to always use the bundled version. +Patch1: python-requests-system-cert-bundle.patch BuildArch: noarch BuildRequires: python2-devel @@ -40,28 +44,59 @@ designed to make HTTP requests easy for developers. %prep %setup -q -n requests-%{version} +%patch0 -p1 +%patch1 -p1 + +### TODO: Need to unbundle libraries in the packages directory. +### https://bugzilla.redhat.com/show_bug.cgi?id=904623 +### Priority urllib3 since it's still bundled in requests-1.0.x +### And it's a security issue: +### https://bugzilla.redhat.com/show_bug.cgi?id=855322 +### https://bugzilla.redhat.com/show_bug.cgi?id=855323 +### Review request for urllib3: +### https://bugzilla.redhat.com/show_bug.cgi?id=907688 +### chardet/2 is available as python-chardet and python3-chardet so +### those may be easy to unbundle as well (will need patching, but looks +### like a single file, compat.py) +### oauthlib isn't packaged yet (and not in requests-1.0.0) +### but the code in requests will already prefer the system version to +### the bundled version + +# Unbundle the certificate bundle from mozilla. +rm -rf requests/cacert.pem + +%if 0%{?_with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif # with_python3 + + %build %if 0%{?_with_python3} +pushd %{py3dir} +rm -rf requests/packages/chardet +# Note -- this means that requests.auth.OAuth1 won't work in py3. +# But, as there isn't an oauthlib for py3, this didn't work anyway. +# Could patch upstream's code to be more explicit about this but +# requests-1.0.x dropped this functionality anyway +rm -rf requests/packages/oauthlib %{__python3} setup.py build +popd %endif + +rm -rf requests/packages/chardet2 %{__python} setup.py build %install rm -rf $RPM_BUILD_ROOT %if 0%{?_with_python3} -PYTHONDONTWRITEBYTECODE=1 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/chardet2 -#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/oauthlib -#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/packages/urllib3 -#%py_byte_compile %{__python} %{buildroot}%{python3_sitelib}/requests/*.py +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd %endif -PYTHONDONTWRITEBYTECODE=1 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/chardet -#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/oauthlib -#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/packages/urllib3 -#%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/requests/*.py -# +%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT + %files %defattr(-,root,root,-) %doc NOTICE LICENSE README.rst HISTORY.rst @@ -77,6 +112,15 @@ PYTHONDONTWRITEBYTECODE=1 %{__python} setup.py install -O1 --skip-build --root $ %changelog +* Fri Feb 8 2013 Toshio Kuratomi - 0.14.1-3 +- 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 + * Wed Oct 22 2012 Arun S A G 0.14.1-1 - Updated to latest upstream release From 4d0266ee281deb5038689a6b36b22509f0500d63 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 8 Feb 2013 13:37:52 -0800 Subject: [PATCH 06/10] Correct changelog release --- python-requests.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-requests.spec b/python-requests.spec index 7771692..9dc34dd 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -112,7 +112,7 @@ popd %changelog -* Fri Feb 8 2013 Toshio Kuratomi - 0.14.1-3 +* 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. From 9d1befdf087ab4e145ed369133197561abfe288a Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 27 Feb 2013 09:35:23 -0500 Subject: [PATCH 07/10] Update to python-requests-1.1.0 (rhbz #915476) --- .gitignore | 1 + python-requests-cookie-handling.patch | 35 --------------- python-requests-system-cert-bundle.patch | 54 ++++++++++++++++++------ python-requests.spec | 34 ++++++++++----- sources | 2 +- 5 files changed, 66 insertions(+), 60 deletions(-) delete mode 100644 python-requests-cookie-handling.patch diff --git a/.gitignore b/.gitignore index 321be65..3fb1685 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /requests-0.11.1.tar.gz /requests-0.13.1.tar.gz /requests-0.14.1.tar.gz +/requests-1.1.0.tar.gz diff --git a/python-requests-cookie-handling.patch b/python-requests-cookie-handling.patch deleted file mode 100644 index 520dea4..0000000 --- a/python-requests-cookie-handling.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 2cecc4bc828fc1754cc26f279ec3ff5cd65cb8f7 Mon Sep 17 00:00:00 2001 -From: Ralph Bean -Date: Thu, 31 Jan 2013 21:38:58 -0500 -Subject: [PATCH] cookie handling - ---- - requests/models.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/requests/models.py b/requests/models.py -index 2193c6e..0a12237 100644 ---- a/requests/models.py -+++ b/requests/models.py -@@ -17,7 +17,7 @@ from .structures import CaseInsensitiveDict - from .status_codes import codes - - from .auth import HTTPBasicAuth, HTTPProxyAuth --from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header -+from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header, RequestsCookieJar - from .packages.urllib3.exceptions import MaxRetryError, LocationParseError - from .packages.urllib3.exceptions import TimeoutError - from .packages.urllib3.exceptions import SSLError as _SSLError -@@ -207,7 +207,8 @@ class Request(object): - extract_cookies_to_jar(self.cookies, self, resp) - - # Save cookies in Response. -- response.cookies = self.cookies -+ response.cookies = RequestsCookieJar() -+ extract_cookies_to_jar(response.cookies, self, resp) - - # Save cookies in Session. - for cookie in self.cookies: --- -1.8.1 - diff --git a/python-requests-system-cert-bundle.patch b/python-requests-system-cert-bundle.patch index 198e4c2..9184c66 100644 --- a/python-requests-system-cert-bundle.patch +++ b/python-requests-system-cert-bundle.patch @@ -1,16 +1,44 @@ -Index: requests-0.14.1/requests/certs.py -=================================================================== ---- requests-0.14.1.orig/requests/certs.py -+++ requests-0.14.1/requests/certs.py -@@ -21,7 +21,10 @@ def where(): - return certifi.where() - else: - f = os.path.split(__file__)[0] -- return os.path.join(f, 'cacert.pem') -+ path = os.path.join(f, 'cacert.pem') -+ if os.path.exists(path): -+ return path -+ return None +From 415619361cc23dd87b1a7a5fd0cfba38e33d24fd Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Wed, 27 Feb 2013 09:16:20 -0500 +Subject: [PATCH] system cert bundle + +--- + requests/certs.py | 17 +++++------------ + 1 file changed, 5 insertions(+), 12 deletions(-) + +diff --git a/requests/certs.py b/requests/certs.py +index 8148276..6e07f5e 100644 +--- a/requests/certs.py ++++ b/requests/certs.py +@@ -10,22 +10,15 @@ 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. +-""" +- +-import os.path + +-certifi = None +-try: +- import certifi +-except ImportError: +- pass ++We return "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates ++package. ++""" + + def where(): + """Return the preferred certificate bundle.""" +- if certifi: +- return certifi.where() +- +- 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.8.1.2 + diff --git a/python-requests.spec b/python-requests.spec index 9dc34dd..caa6298 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -3,21 +3,17 @@ %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif + Name: python-requests -Version: 0.14.1 -Release: 4%{?dist} +Version: 1.1.0 +Release: 1%{?dist} Summary: HTTP library, written in Python, for human beings -License: ISC and MIT +License: ASL 2.0 URL: http://pypi.python.org/pypi/requests Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz -# Separate response cookies from request cookies discussed here: -# https://github.com/fedora-infra/python-fedora/pull/6 -Patch0: python-requests-cookie-handling.patch -# Use the system certificates in ca-certificates. This patch causes util.py -# to search for the system bundle (whereas now the return value of -# certs.where() causes it to always use the bundled version. -Patch1: python-requests-system-cert-bundle.patch +# Explicitly use the system certificates in ca-certificates. +Patch0: python-requests-system-cert-bundle.patch BuildArch: noarch BuildRequires: python2-devel @@ -45,7 +41,6 @@ designed to make HTTP requests easy for developers. %setup -q -n requests-%{version} %patch0 -p1 -%patch1 -p1 ### TODO: Need to unbundle libraries in the packages directory. ### https://bugzilla.redhat.com/show_bug.cgi?id=904623 @@ -97,6 +92,16 @@ popd %{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +## The tests succeed if run locally, but fail in koji. +## They require an active network connection to query httpbin.org +#%%check +#%%{__python} test_requests.py +#%%if 0%%{?_with_python3} +#pushd %%{py3dir} +#%%{__python3} test_requests.py +#popd +#%%endif + %files %defattr(-,root,root,-) %doc NOTICE LICENSE README.rst HISTORY.rst @@ -112,6 +117,13 @@ popd %changelog +* 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 diff --git a/sources b/sources index 611d373..f5403f5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3de30600072cbc7214ae342d1d08aa46 requests-0.14.1.tar.gz +a0158815af244c32041a3147ee09abf3 requests-1.1.0.tar.gz From 3984dc7586358dbb472505b337c4eb7ee2ff10bf Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 27 Feb 2013 10:05:23 -0500 Subject: [PATCH 08/10] Removed comment about oauthlib. No longer relevant. --- python-requests.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/python-requests.spec b/python-requests.spec index caa6298..15f05d3 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -53,9 +53,6 @@ designed to make HTTP requests easy for developers. ### chardet/2 is available as python-chardet and python3-chardet so ### those may be easy to unbundle as well (will need patching, but looks ### like a single file, compat.py) -### oauthlib isn't packaged yet (and not in requests-1.0.0) -### but the code in requests will already prefer the system version to -### the bundled version # Unbundle the certificate bundle from mozilla. rm -rf requests/cacert.pem From 7fe5b101d03116867e9ff935332b048a45b2a38b Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 27 Feb 2013 10:38:40 -0500 Subject: [PATCH 09/10] Unbundle python-charade/chardet --- ...-requests-system-chardet-not-charade.patch | 25 ++++++++++++ python-requests.spec | 39 ++++++++++++------- 2 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 python-requests-system-chardet-not-charade.patch diff --git a/python-requests-system-chardet-not-charade.patch b/python-requests-system-chardet-not-charade.patch new file mode 100644 index 0000000..e9abcf2 --- /dev/null +++ b/python-requests-system-chardet-not-charade.patch @@ -0,0 +1,25 @@ +From 07c1df1053a61ec5097fe79c68aba7fda7bac3b5 Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Wed, 27 Feb 2013 10:03:41 -0500 +Subject: [PATCH] Use system chardet, not charade. + +--- + requests/compat.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/requests/compat.py b/requests/compat.py +index 5bd4fcb..39421ed 100644 +--- a/requests/compat.py ++++ b/requests/compat.py +@@ -4,7 +4,7 @@ + pythoncompat + """ + +-from .packages import charade as chardet ++import chardet + + import sys + +-- +1.8.1.2 + diff --git a/python-requests.spec b/python-requests.spec index 15f05d3..a6e6e01 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -6,18 +6,25 @@ Name: python-requests Version: 1.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 URL: http://pypi.python.org/pypi/requests Source0: http://pypi.python.org/packages/source/r/requests/requests-%{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 +# Unbundle python-charade (a fork of python-chardet). +# https://bugzilla.redhat.com/show_bug.cgi?id=904623 +Patch1: python-requests-system-chardet-not-charade.patch + BuildArch: noarch BuildRequires: python2-devel +BuildRequires: python-chardet Requires: ca-certificates +Requires: python-chardet %description Most existing Python modules for sending HTTP requests are extremely verbose and @@ -28,7 +35,10 @@ designed to make HTTP requests easy for developers. %if 0%{?_with_python3} %package -n python3-requests Summary: HTTP library, written in Python, for human beings -BuildRequires: python3-devel +BuildRequires: python3-devel +BuildRequires: python3-chardet +Requires: python3-chardet + %description -n python3-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 @@ -41,6 +51,7 @@ designed to make HTTP requests easy for developers. %setup -q -n requests-%{version} %patch0 -p1 +%patch1 -p1 ### TODO: Need to unbundle libraries in the packages directory. ### https://bugzilla.redhat.com/show_bug.cgi?id=904623 @@ -50,9 +61,6 @@ designed to make HTTP requests easy for developers. ### https://bugzilla.redhat.com/show_bug.cgi?id=855323 ### Review request for urllib3: ### https://bugzilla.redhat.com/show_bug.cgi?id=907688 -### chardet/2 is available as python-chardet and python3-chardet so -### those may be easy to unbundle as well (will need patching, but looks -### like a single file, compat.py) # Unbundle the certificate bundle from mozilla. rm -rf requests/cacert.pem @@ -62,23 +70,22 @@ rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 - %build %if 0%{?_with_python3} pushd %{py3dir} -rm -rf requests/packages/chardet -# Note -- this means that requests.auth.OAuth1 won't work in py3. -# But, as there isn't an oauthlib for py3, this didn't work anyway. -# Could patch upstream's code to be more explicit about this but -# requests-1.0.x dropped this functionality anyway -rm -rf requests/packages/oauthlib %{__python3} setup.py build + +# Unbundle chardet. Patch1 switches usage to system chardet. +rm -rf build/lib/requests/packages/charade + popd %endif -rm -rf requests/packages/chardet2 %{__python} setup.py build +# Unbundle chardet. Patch1 switches usage to system chardet. +rm -rf build/lib/requests/packages/charade + %install rm -rf $RPM_BUILD_ROOT %if 0%{?_with_python3} @@ -114,6 +121,12 @@ popd %changelog +* 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. From 2f898f274c560a0fb5ac48719a9529f68688fb7a Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 28 Feb 2013 12:22:15 -0500 Subject: [PATCH 10/10] Unbundle python-urllib3. --- python-requests-system-urllib3.patch | 81 ++++++++++++++++++++++++++++ python-requests.spec | 36 ++++++++----- 2 files changed, 105 insertions(+), 12 deletions(-) create mode 100644 python-requests-system-urllib3.patch diff --git a/python-requests-system-urllib3.patch b/python-requests-system-urllib3.patch new file mode 100644 index 0000000..90b078b --- /dev/null +++ b/python-requests-system-urllib3.patch @@ -0,0 +1,81 @@ +From 5d23c608e72025f72e1f3223cb6c7e3979e93c7f Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Thu, 28 Feb 2013 10:57:20 -0500 +Subject: [PATCH] system-urllib3 + +--- + requests/adapters.py | 12 ++++++------ + requests/compat.py | 6 +++++- + requests/models.py | 4 ++-- + 3 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/requests/adapters.py b/requests/adapters.py +index 5f9d9c7..1f61bd6 100644 +--- a/requests/adapters.py ++++ b/requests/adapters.py +@@ -11,17 +11,17 @@ and maintain connections. + import socket + + from .models import Response +-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url +-from .packages.urllib3.response import HTTPResponse ++from urllib3.poolmanager import PoolManager, proxy_from_url ++from urllib3.response import HTTPResponse + from .hooks import dispatch_hook + from .compat import urlparse, basestring, urldefrag + from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, + prepend_scheme_if_needed) + from .structures import CaseInsensitiveDict +-from .packages.urllib3.exceptions import MaxRetryError +-from .packages.urllib3.exceptions import TimeoutError +-from .packages.urllib3.exceptions import SSLError as _SSLError +-from .packages.urllib3.exceptions import HTTPError as _HTTPError ++from urllib3.exceptions import MaxRetryError ++from urllib3.exceptions import TimeoutError ++from urllib3.exceptions import SSLError as _SSLError ++from urllib3.exceptions import HTTPError as _HTTPError + from .cookies import extract_cookies_to_jar + from .exceptions import ConnectionError, Timeout, SSLError + +diff --git a/requests/compat.py b/requests/compat.py +index 39421ed..d9ab218 100644 +--- a/requests/compat.py ++++ b/requests/compat.py +@@ -89,7 +89,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 ++ except ImportError: ++ from ordereddict import OrderedDict + + builtin_str = str + bytes = str +diff --git a/requests/models.py b/requests/models.py +index 5202e6f..218b4f2 100644 +--- a/requests/models.py ++++ b/requests/models.py +@@ -17,7 +17,7 @@ from .status_codes import codes + + from .auth import HTTPBasicAuth + from .cookies import cookiejar_from_dict, get_cookie_header +-from .packages.urllib3.filepost import encode_multipart_formdata ++from urllib3.filepost import encode_multipart_formdata + from .exceptions import HTTPError, RequestException, MissingSchema, InvalidURL + from .utils import ( + stream_untransfer, guess_filename, requote_uri, +@@ -121,7 +121,7 @@ class RequestEncodingMixin(object): + fp = StringIO(fp) + if isinstance(fp, bytes): + fp = BytesIO(fp) +- ++ + if ft: + new_v = (fn, fp.read(), ft) + else: +-- +1.8.1.2 + diff --git a/python-requests.spec b/python-requests.spec index a6e6e01..31e2386 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -6,7 +6,7 @@ Name: python-requests Version: 1.1.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 @@ -18,13 +18,23 @@ Patch0: python-requests-system-cert-bundle.patch # Unbundle python-charade (a fork of python-chardet). # https://bugzilla.redhat.com/show_bug.cgi?id=904623 Patch1: python-requests-system-chardet-not-charade.patch +# Unbundle python-charade (a fork of python-urllib3). +# https://bugzilla.redhat.com/show_bug.cgi?id=904623 +Patch2: python-requests-system-urllib3.patch BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-chardet +BuildRequires: python-urllib3 Requires: ca-certificates Requires: python-chardet +Requires: python-urllib3 + +%if 0%{?rhel} +BuildRequires: python-ordereddict +Requires: python-ordereddict +%endif %description Most existing Python modules for sending HTTP requests are extremely verbose and @@ -37,7 +47,9 @@ designed to make HTTP requests easy for developers. Summary: HTTP library, written in Python, for human beings BuildRequires: python3-devel BuildRequires: python3-chardet +BuildRequires: python3-urllib3 Requires: python3-chardet +Requires: python3-urllib3 %description -n python3-requests Most existing Python modules for sending HTTP requests are extremely verbose and @@ -46,21 +58,12 @@ capabilities you should need, but the API is thoroughly broken. This library is designed to make HTTP requests easy for developers. %endif - %prep %setup -q -n requests-%{version} %patch0 -p1 %patch1 -p1 - -### TODO: Need to unbundle libraries in the packages directory. -### https://bugzilla.redhat.com/show_bug.cgi?id=904623 -### Priority urllib3 since it's still bundled in requests-1.0.x -### And it's a security issue: -### https://bugzilla.redhat.com/show_bug.cgi?id=855322 -### https://bugzilla.redhat.com/show_bug.cgi?id=855323 -### Review request for urllib3: -### https://bugzilla.redhat.com/show_bug.cgi?id=907688 +%patch2 -p1 # Unbundle the certificate bundle from mozilla. rm -rf requests/cacert.pem @@ -78,6 +81,9 @@ pushd %{py3dir} # Unbundle chardet. Patch1 switches usage to system chardet. rm -rf build/lib/requests/packages/charade +# Unbundle urllib3. Patch1 switches usage to system urllib3. +rm -rf build/lib/requests/packages + popd %endif @@ -86,6 +92,9 @@ popd # Unbundle chardet. Patch1 switches usage to system chardet. rm -rf build/lib/requests/packages/charade +# Unbundle urllib3. Patch1 switches usage to system urllib3. +rm -rf build/lib/requests/packages + %install rm -rf $RPM_BUILD_ROOT %if 0%{?_with_python3} @@ -119,8 +128,11 @@ popd %{python3_sitelib}/requests/ %endif - %changelog +* 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.