aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch')
-rw-r--r--debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch b/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch
new file mode 100644
index 0000000..e26d9ae
--- /dev/null
+++ b/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch
@@ -0,0 +1,34 @@
+Description: Make Python import system know that requests.packages.urllib3 and
+urllib3 are the same thing.
+Author: Jakub Wilk <jwilk@debian.org>
+Forwarded: not-needed
+Bug-Debian: https://bugs.debian.org/769047
+Last-Update: 2014-11-05
+
+--- a/requests/__init__.py
++++ b/requests/__init__.py
+@@ -48,6 +48,24 @@
+ __license__ = 'Apache 2.0'
+ __copyright__ = 'Copyright 2014 Kenneth Reitz'
+
++# On Debian make Python import system know that requests.packages.urllib3
++# and urllib3 are the same thing.
++import pkgutil
++import sys
++import urllib3
++
++def _attach_namespace(package, where):
++ for loader, name, ispkg in pkgutil.walk_packages(package.__path__,
++ package.__name__ + '.'):
++ try:
++ module = __import__(name)
++ except ImportError:
++ continue
++ sys.modules[where + '.' + name] = module
++
++_attach_namespace(urllib3, 'requests.packages')
++del _attach_namespace
++
+ # Attempt to enable urllib3's SNI support, if possible
+ try:
+ from urllib3.contrib import pyopenssl