diff options
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rw-r--r-- | debian/.git-dpm | 8 | ||||
-rw-r--r-- | debian/patches/01_use-system-ca-certificates.patch | 34 | ||||
-rw-r--r-- | debian/patches/03_export-IncompleteRead.patch | 18 | ||||
-rw-r--r-- | debian/patches/05_upstream_devendorize.patch | 11 | ||||
-rw-r--r-- | requests/certs.py | 4 | ||||
-rw-r--r-- | requests/compat.py | 2 | ||||
-rw-r--r-- | requests/packages/__init__.py | 35 | ||||
-rwxr-xr-x | setup.py | 2 |
9 files changed, 94 insertions, 22 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 439de49..7888aee 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt requests/cacert.pem +include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt diff --git a/debian/.git-dpm b/debian/.git-dpm new file mode 100644 index 0000000..5505bf5 --- /dev/null +++ b/debian/.git-dpm @@ -0,0 +1,8 @@ +# see git-dpm(1) from git-dpm package +bf94fe6ca734a95614c33473cad145323d3495d3 +bf94fe6ca734a95614c33473cad145323d3495d3 +b4a5af4fcbf4e5d0f741aaf9978c728235b11a56 +b4a5af4fcbf4e5d0f741aaf9978c728235b11a56 +requests_2.7.0.orig.tar.gz +6db8805632521a13789161bccb14f761672ec46f +451723 diff --git a/debian/patches/01_use-system-ca-certificates.patch b/debian/patches/01_use-system-ca-certificates.patch index b5cfeec..0a503bc 100644 --- a/debian/patches/01_use-system-ca-certificates.patch +++ b/debian/patches/01_use-system-ca-certificates.patch @@ -1,12 +1,31 @@ -Description: Use the bundle provided by ca-certificates instead of +From 3345f5ca045c5cb0a2f55ad39244c5ad37ce385e Mon Sep 17 00:00:00 2001 +From: Daniele Tricoli <eriol@mornie.org> +Date: Thu, 8 Oct 2015 13:41:42 -0700 +Subject: Use the bundle provided by ca-certificates instead of + the embedded one. -Author: Daniele Tricoli <eriol@mornie.org> Forwarded: not-needed Last-Update: 2014-10-08 +Patch-Name: 01_use-system-ca-certificates.patch +--- + MANIFEST.in | 2 +- + requests/certs.py | 4 ++-- + setup.py | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/MANIFEST.in b/MANIFEST.in +index 439de49..7888aee 100644 +--- a/MANIFEST.in ++++ b/MANIFEST.in +@@ -1 +1 @@ +-include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt requests/cacert.pem ++include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt +diff --git a/requests/certs.py b/requests/certs.py +index 07e6475..e61ee5d 100644 --- a/requests/certs.py +++ b/requests/certs.py -@@ -18,8 +18,8 @@ +@@ -18,8 +18,8 @@ try: except ImportError: def where(): """Return the preferred certificate bundle.""" @@ -17,9 +36,11 @@ Last-Update: 2014-10-08 if __name__ == '__main__': print(where()) +diff --git a/setup.py b/setup.py +index f98f528..eb444f1 100755 --- a/setup.py +++ b/setup.py -@@ -50,7 +50,7 @@ +@@ -50,7 +50,7 @@ setup( author_email='me@kennethreitz.com', url='http://python-requests.org', packages=packages, @@ -28,8 +49,3 @@ Last-Update: 2014-10-08 package_dir={'requests': 'requests'}, include_package_data=True, install_requires=requires, ---- a/MANIFEST.in -+++ b/MANIFEST.in -@@ -1 +1 @@ --include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt requests/cacert.pem -+include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt diff --git a/debian/patches/03_export-IncompleteRead.patch b/debian/patches/03_export-IncompleteRead.patch index 82938eb..4f8ff15 100644 --- a/debian/patches/03_export-IncompleteRead.patch +++ b/debian/patches/03_export-IncompleteRead.patch @@ -1,13 +1,23 @@ -Description: Export IncompleteRead from requests.compat since it's +From 063c9ec0a3d27a0ca437c0b8dba5ea17e2a032ef Mon Sep 17 00:00:00 2001 +From: Daniele Tricoli <eriol@mornie.org> +Date: Thu, 8 Oct 2015 13:41:43 -0700 +Subject: Export IncompleteRead from requests.compat since it's + imported by python-pip. -Author: Daniele Tricoli <eriol@mornie.org> Forwarded: not-needed Bug-Debian: https://bugs.debian.org/766419 Last-Update: 2014-10-23 +Patch-Name: 03_export-IncompleteRead.patch +--- + requests/compat.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/requests/compat.py b/requests/compat.py +index 70edff7..a338846 100644 --- a/requests/compat.py +++ b/requests/compat.py -@@ -40,6 +40,7 @@ +@@ -40,6 +40,7 @@ if is_py2: from Cookie import Morsel from StringIO import StringIO from .packages.urllib3.packages.ordered_dict import OrderedDict @@ -15,7 +25,7 @@ Last-Update: 2014-10-23 builtin_str = str bytes = str -@@ -54,6 +55,7 @@ +@@ -54,6 +55,7 @@ elif is_py3: from http.cookies import Morsel from io import StringIO from collections import OrderedDict diff --git a/debian/patches/05_upstream_devendorize.patch b/debian/patches/05_upstream_devendorize.patch index 2a4a9d5..1c5750f 100644 --- a/debian/patches/05_upstream_devendorize.patch +++ b/debian/patches/05_upstream_devendorize.patch @@ -1,13 +1,16 @@ -From b7fc3a1250cb13ed3b55010ccc33f2681f0ffa4a Mon Sep 17 00:00:00 2001 +From bf94fe6ca734a95614c33473cad145323d3495d3 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer <markus@unterwaditzer.net> Date: Fri, 24 Apr 2015 12:05:18 +0200 -Subject: [PATCH 1/2] Import aliases for Debian +Subject: Import aliases for Debian Alternative to #2375 +Patch-Name: 05_upstream_devendorize.patch --- - requests/packages/__init__.py | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) + requests/packages/__init__.py | 35 ++++++++++++++++++++++++++++++++++- + 1 file changed, 34 insertions(+), 1 deletion(-) +diff --git a/requests/packages/__init__.py b/requests/packages/__init__.py +index d62c4b7..971c2ad 100644 --- a/requests/packages/__init__.py +++ b/requests/packages/__init__.py @@ -1,3 +1,36 @@ diff --git a/requests/certs.py b/requests/certs.py index 07e6475..e61ee5d 100644 --- a/requests/certs.py +++ b/requests/certs.py @@ -18,8 +18,8 @@ try: except ImportError: def where(): """Return the preferred certificate bundle.""" - # vendored bundle inside Requests - return os.path.join(os.path.dirname(__file__), 'cacert.pem') + # On Debian systems use ca-certificates + return '/etc/ssl/certs/ca-certificates.crt' if __name__ == '__main__': print(where()) diff --git a/requests/compat.py b/requests/compat.py index 70edff7..a338846 100644 --- a/requests/compat.py +++ b/requests/compat.py @@ -40,6 +40,7 @@ if is_py2: from Cookie import Morsel from StringIO import StringIO from .packages.urllib3.packages.ordered_dict import OrderedDict + from httplib import IncompleteRead builtin_str = str bytes = str @@ -54,6 +55,7 @@ elif is_py3: from http.cookies import Morsel from io import StringIO from collections import OrderedDict + from http.client import IncompleteRead builtin_str = str str = str diff --git a/requests/packages/__init__.py b/requests/packages/__init__.py index d62c4b7..971c2ad 100644 --- a/requests/packages/__init__.py +++ b/requests/packages/__init__.py @@ -1,3 +1,36 @@ +''' +Debian and other distributions "unbundle" requests' vendored dependencies, and +rewrite all imports to use the global versions of ``urllib3`` and ``chardet``. +The problem with this is that not only requests itself imports those +dependencies, but third-party code outside of the distros' control too. + +In reaction to these problems, the distro maintainers replaced +``requests.packages`` with a magical "stub module" that imports the correct +modules. The implementations were varying in quality and all had severe +problems. For example, a symlink (or hardlink) that links the correct modules +into place introduces problems regarding object identity, since you now have +two modules in `sys.modules` with the same API, but different identities:: + + requests.packages.urllib3 is not urllib3 + +With version ``2.5.2``, requests started to maintain its own stub, so that +distro-specific breakage would be reduced to a minimum, even though the whole +issue is not requests' fault in the first place. See +https://github.com/kennethreitz/requests/pull/2375 for the corresponding pull +request. +''' + from __future__ import absolute_import +import sys + +try: + from . import urllib3 +except ImportError: + import urllib3 + sys.modules['%s.urllib3' % __name__] = urllib3 -from . import urllib3 +try: + from . import chardet +except ImportError: + import chardet + sys.modules['%s.chardet' % __name__] = chardet @@ -50,7 +50,7 @@ setup( author_email='me@kennethreitz.com', url='http://python-requests.org', packages=packages, - package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']}, + package_data={'': ['LICENSE', 'NOTICE'],}, package_dir={'requests': 'requests'}, include_package_data=True, install_requires=requires, |