From 9d1befdf087ab4e145ed369133197561abfe288a Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Wed, 27 Feb 2013 09:35:23 -0500 Subject: [PATCH] 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