From 0989c03fcb65c0e1b5e077c7e881b096468dce93 Mon Sep 17 00:00:00 2001 From: Jacek Konieczny Date: Wed, 2 Aug 2017 10:49:41 +0200 Subject: [PATCH] Version: 2.18.2 No more bundled madness in this release :) system-cert.patch update: use system certs, but fall back to certifi if ca-certificates package is not installed. --- ...-requests-remove-nested-bundling-dep.patch | 29 ---------- python-requests.spec | 54 ++++++++----------- system-cert.patch | 24 +++++---- 3 files changed, 36 insertions(+), 71 deletions(-) delete mode 100644 python-requests-remove-nested-bundling-dep.patch 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.spec b/python-requests.spec index c8a4156..ad0da4d 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -3,29 +3,27 @@ %bcond_with tests # test target (tests not included in dist tarball as of 2.13.0) %bcond_without python2 # CPython 2.x module %bcond_without python3 # CPython 3.x module -%bcond_without bundled # bundled libraries # -%define urllib3ver 1.20 +%define urllib3ver 1.21.1 %define module requests Summary: HTTP library for Python 2 Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 2 Name: python-%{module} -Version: 2.13.0 +Version: 2.18.2 Release: 1 License: Apache v2.0 Group: Development/Languages/Python -Source0: https://pypi.python.org/packages/16/09/37b69de7c924d318e51ece1c4ceb679bf93be9d05973bb30c35babd596e2/%{module}-%{version}.tar.gz -# Source0-md5: 921ec6b48f2ddafc8bb6160957baf444 -Patch0: %{name}-remove-nested-bundling-dep.patch -Patch1: system-cert.patch +Source0: https://pypi.python.org/packages/07/2e/81fdfdfac91cf3cb2518fb149ac67caf0e081b485eab68e9aee63396f7e8/requests-2.18.2.tar.gz +# Source0-md5: 49bd9924d3be341871bc922cde6f372e +Patch0: system-cert.patch URL: http://python-requests.org/ %if %{with python2} BuildRequires: python-modules >= 1:2.6 -%if %{without bundled} -BuildRequires: python-chardet >= 2.3.0 -BuildRequires: python-urllib3 >= %{urllib3ver} -%endif %if %{with tests} +BuildRequires: python-chardet >= 3.0.2 +BuildRequires: python-idna >= 2.5 +BuildRequires: python-urllib3 >= %{urllib3ver} +BuildRequires: python-certifi >= 2017.4.17 BuildRequires: python-pytest >= 2.8.0 BuildRequires: python-pytest-cov BuildRequires: python-pytest-httpbin >= 0.0.7 @@ -34,11 +32,11 @@ BuildRequires: python-pytest-mock %endif %if %{with python3} BuildRequires: python3-modules >= 1:3.2 -%if %{without bundled} -BuildRequires: python3-chardet >= 2.3.0 -BuildRequires: python3-urllib3 >= %{urllib3ver} -%endif %if %{with tests} +BuildRequires: python3-chardet >= 3.0.2 +BuildRequires: python3-idna >= 2.5 +BuildRequires: python3-urllib3 >= %{urllib3ver} +BuildRequires: python3-certifi >= 2017.4.17 BuildRequires: python3-pytest >= 2.8.0 BuildRequires: python3-pytest-cov BuildRequires: python3-pytest-httpbin >= 0.0.7 @@ -47,13 +45,10 @@ BuildRequires: python3-pytest-mock %endif BuildRequires: rpm-pythonprov BuildRequires: rpmbuild(macros) >= 1.713 -Requires: ca-certificates -Requires: python-idna >= 2.0.0 -Requires: python-modules >= 1:2.6 -%if %{without bundled} -Requires: python-chardet >= 2.3.0 +Suggests: ca-certificates +Requires: python-chardet >= 3.0.2 +Requires: python-idna >= 2.5 Requires: python-urllib3 >= %{urllib3ver} -%endif # for python2 only to get SNI working. python3 doesn't need this Requires: python-ndg-httpsclient Requires: python-pyasn1 @@ -88,13 +83,10 @@ Ten pakiet zawiera moduł dla Pythona 2.x. Summary: HTTP library for Python 3 Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 3 Group: Development/Languages/Python -Requires: ca-certificates -Requires: python3-modules >= 1:3.2 -%if %{without bundled} -Requires: python3-chardet >= 2.3.0 -Requires: python3-idna >= 2.0.0 -Requires: python3-urllib3 >= %{urllib3ver} -%endif +Suggests: ca-certificates +Requires: python-chardet >= 3.0.2 +Requires: python-idna >= 2.5 +Requires: python-urllib3 >= %{urllib3ver} %description -n python3-requests Requests is a HTTP library, written in Python, for human beings. @@ -121,8 +113,7 @@ Ten pakiet zawiera moduł dla Pythona 3.x. %prep %setup -q -n %{module}-%{version} -%{!?with_bundled:%patch0 -p1} -%patch1 -p1 +%patch0 -p1 %build %if %{with python2} @@ -147,9 +138,6 @@ rm -rf $RPM_BUILD_ROOT %py3_install %endif -%{__rm} $RPM_BUILD_ROOT{%{py_sitescriptdir},%{py3_sitescriptdir}}/%{module}/cacert.pem -%{!?with_bundled:%{__rm} -r $RPM_BUILD_ROOT{%{py_sitescriptdir},%{py3_sitescriptdir}}/%{module}/packages} - %clean rm -rf $RPM_BUILD_ROOT diff --git a/system-cert.patch b/system-cert.patch index 6066d30..082e934 100644 --- a/system-cert.patch +++ b/system-cert.patch @@ -1,13 +1,19 @@ ---- requests-2.4.1/requests/certs.py~ 2014-08-19 18:52:58.000000000 +0200 -+++ requests-2.4.1/requests/certs.py 2014-09-24 15:15:55.773227329 +0200 -@@ -18,8 +18,8 @@ - except ImportError: - def where(): - """Return the preferred certificate bundle.""" -- # vendored bundle inside Requests -- return os.path.join(os.path.dirname(__file__), 'cacert.pem') -+ # system certificates from ca-certificates package +diff -dur requests-2.18.2.orig/requests/certs.py requests-2.18.2/requests/certs.py +--- requests-2.18.2.orig/requests/certs.py 2017-05-31 11:19:09.000000000 +0200 ++++ requests-2.18.2/requests/certs.py 2017-08-01 14:30:44.000000000 +0200 +@@ -12,7 +12,14 @@ + environment, you can change the definition of where() to return a separately + packaged CA bundle. + """ +-from certifi import where ++ ++import os ++ ++if os.path.exists("/etc/certs/ca-certificates.crt"): ++ def where(): + return "/etc/certs/ca-certificates.crt" ++else: ++ from certifi import where if __name__ == '__main__': print(where()) -- 2.44.0