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.patch46
1 files changed, 46 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..0e4db29
--- /dev/null
+++ b/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch
@@ -0,0 +1,46 @@
+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
+Bug-Debian: https://bugs.debian.org/769496
+Last-Update: 2015-05-03
+
+--- a/requests/__init__.py
++++ b/requests/__init__.py
+@@ -48,6 +48,28 @@
+ __license__ = 'Apache 2.0'
+ __copyright__ = 'Copyright 2015 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):
++ # Attach package top namespace
++ sys.modules[where + '.' + package.__name__] = package
++ 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
++# Python 3 needs this imported explicitly.
++import requests.packages
++
+ # Attempt to enable urllib3's SNI support, if possible
+ try:
+ from urllib3.contrib import pyopenssl
+--- a/requests/packages/__init__.py
++++ b/requests/packages/__init__.py
+@@ -1,3 +1,3 @@
+ from __future__ import absolute_import
+
+-from . import urllib3
++import urllib3