aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Tricoli <eriol@mornie.org>2015-06-10 22:46:16 +0000
committerDaniele Tricoli <eriol@mornie.org>2015-06-10 22:46:16 +0000
commit25d0586d70b755b5fea8dded90836816fb855149 (patch)
tree58b8e27e55bca9dc8ffe024e86687b290a4e4d58
parent7e07fbb19d3d156fa122e06083b8c550dccb6f17 (diff)
downloadpython-requests-25d0586d70b755b5fea8dded90836816fb855149.tar
python-requests-25d0586d70b755b5fea8dded90836816fb855149.tar.gz
Cherry pick upstream devendorize patch
-rw-r--r--debian/changelog13
-rw-r--r--debian/patches/02_use-system-chardet-and-urllib3.patch129
-rw-r--r--debian/patches/03_export-IncompleteRead.patch6
-rw-r--r--debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch46
-rw-r--r--debian/patches/05_upstream_devendorize.patch50
-rw-r--r--debian/patches/series3
6 files changed, 67 insertions, 180 deletions
diff --git a/debian/changelog b/debian/changelog
index 6e2eef5..50c7653 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+requests (2.7.0-3) UNRELEASED; urgency=medium
+
+ [ Barry Warsaw ]
+ * debian/patches:
+ - 02_use-system-chardet-and-urllib3.patch and
+ 04_make-requests.packages.urllib3-same-as-urllib3.patch: Removed in
+ favor of upstream's pull request #2567
+ - 05_upstream_devendorize.patch: Upstream's pull request to better
+ support the devendorizing of urllib3 and chardet.
+ (Closes: #771349, #788383)
+
+ -- Daniele Tricoli <eriol@mornie.org> Thu, 11 Jun 2015 00:41:05 +0200
+
requests (2.7.0-2) unstable; urgency=medium
* Upload to unstable.
diff --git a/debian/patches/02_use-system-chardet-and-urllib3.patch b/debian/patches/02_use-system-chardet-and-urllib3.patch
deleted file mode 100644
index 956ffb8..0000000
--- a/debian/patches/02_use-system-chardet-and-urllib3.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-Description: Use the system python-chardet and python-urllib3 instead of the
- embedded copies but provide requests.packages package because it will be
- used to supply a stub for ``requests.packages.urllib3``.
-Author: Daniele Tricoli <eriol@mornie.org>
-Forwarded: not-needed
-Last-Update: 2015-05-04
-
---- a/requests/adapters.py
-+++ b/requests/adapters.py
-@@ -11,22 +11,22 @@
- import socket
-
- from .models import Response
--from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
--from .packages.urllib3.response import HTTPResponse
--from .packages.urllib3.util import Timeout as TimeoutSauce
--from .packages.urllib3.util.retry import Retry
-+from urllib3.poolmanager import PoolManager, proxy_from_url
-+from urllib3.response import HTTPResponse
-+from urllib3.util import Timeout as TimeoutSauce
-+from urllib3.util.retry import Retry
- from .compat import urlparse, basestring
- from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
- prepend_scheme_if_needed, get_auth_from_url, urldefragauth)
- from .structures import CaseInsensitiveDict
--from .packages.urllib3.exceptions import ConnectTimeoutError
--from .packages.urllib3.exceptions import HTTPError as _HTTPError
--from .packages.urllib3.exceptions import MaxRetryError
--from .packages.urllib3.exceptions import ProxyError as _ProxyError
--from .packages.urllib3.exceptions import ProtocolError
--from .packages.urllib3.exceptions import ReadTimeoutError
--from .packages.urllib3.exceptions import SSLError as _SSLError
--from .packages.urllib3.exceptions import ResponseError
-+from urllib3.exceptions import ConnectTimeoutError
-+from urllib3.exceptions import HTTPError as _HTTPError
-+from urllib3.exceptions import MaxRetryError
-+from urllib3.exceptions import ProxyError as _ProxyError
-+from urllib3.exceptions import ProtocolError
-+from urllib3.exceptions import ReadTimeoutError
-+from urllib3.exceptions import SSLError as _SSLError
-+from urllib3.exceptions import ResponseError
- from .cookies import extract_cookies_to_jar
- from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
- ProxyError, RetryError)
---- a/requests/compat.py
-+++ b/requests/compat.py
-@@ -4,7 +4,7 @@
- pythoncompat
- """
-
--from .packages import chardet
-+import chardet
-
- import sys
-
-@@ -39,7 +39,7 @@
- import cookielib
- from Cookie import Morsel
- from StringIO import StringIO
-- from .packages.urllib3.packages.ordered_dict import OrderedDict
-+ from urllib3.packages.ordered_dict import OrderedDict
-
- builtin_str = str
- bytes = str
---- a/requests/models.py
-+++ b/requests/models.py
-@@ -16,10 +16,10 @@
-
- from .auth import HTTPBasicAuth
- from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
--from .packages.urllib3.fields import RequestField
--from .packages.urllib3.filepost import encode_multipart_formdata
--from .packages.urllib3.util import parse_url
--from .packages.urllib3.exceptions import (
-+from urllib3.fields import RequestField
-+from urllib3.filepost import encode_multipart_formdata
-+from urllib3.util import parse_url
-+from urllib3.exceptions import (
- DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
- from .exceptions import (
- HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
---- a/setup.py
-+++ b/setup.py
-@@ -18,12 +18,6 @@
- packages = [
- 'requests',
- 'requests.packages',
-- 'requests.packages.chardet',
-- 'requests.packages.urllib3',
-- 'requests.packages.urllib3.packages',
-- 'requests.packages.urllib3.contrib',
-- 'requests.packages.urllib3.util',
-- 'requests.packages.urllib3.packages.ssl_match_hostname',
- ]
-
- requires = []
---- a/requests/__init__.py
-+++ b/requests/__init__.py
-@@ -50,7 +50,7 @@
-
- # Attempt to enable urllib3's SNI support, if possible
- try:
-- from .packages.urllib3.contrib import pyopenssl
-+ from urllib3.contrib import pyopenssl
- pyopenssl.inject_into_urllib3()
- except ImportError:
- pass
---- a/requests/exceptions.py
-+++ b/requests/exceptions.py
-@@ -7,7 +7,7 @@
- This module contains the set of Requests' exceptions.
-
- """
--from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
-+from urllib3.exceptions import HTTPError as BaseHTTPError
-
-
- class RequestException(IOError):
---- a/requests/sessions.py
-+++ b/requests/sessions.py
-@@ -21,7 +21,7 @@
- from .utils import to_key_val_list, default_headers, to_native_string
- from .exceptions import (
- TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError)
--from .packages.urllib3._collections import RecentlyUsedContainer
-+from urllib3._collections import RecentlyUsedContainer
- from .structures import CaseInsensitiveDict
-
- from .adapters import HTTPAdapter
diff --git a/debian/patches/03_export-IncompleteRead.patch b/debian/patches/03_export-IncompleteRead.patch
index d953df6..82938eb 100644
--- a/debian/patches/03_export-IncompleteRead.patch
+++ b/debian/patches/03_export-IncompleteRead.patch
@@ -7,15 +7,15 @@ Last-Update: 2014-10-23
--- a/requests/compat.py
+++ b/requests/compat.py
-@@ -92,6 +92,7 @@
+@@ -40,6 +40,7 @@
from Cookie import Morsel
from StringIO import StringIO
- from urllib3.packages.ordered_dict import OrderedDict
+ from .packages.urllib3.packages.ordered_dict import OrderedDict
+ from httplib import IncompleteRead
builtin_str = str
bytes = str
-@@ -107,6 +108,7 @@
+@@ -54,6 +55,7 @@
from http.cookies import Morsel
from io import StringIO
from collections import OrderedDict
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
deleted file mode 100644
index 0e4db29..0000000
--- a/debian/patches/04_make-requests.packages.urllib3-same-as-urllib3.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-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
diff --git a/debian/patches/05_upstream_devendorize.patch b/debian/patches/05_upstream_devendorize.patch
new file mode 100644
index 0000000..2a4a9d5
--- /dev/null
+++ b/debian/patches/05_upstream_devendorize.patch
@@ -0,0 +1,50 @@
+From b7fc3a1250cb13ed3b55010ccc33f2681f0ffa4a 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
+
+Alternative to #2375
+---
+ requests/packages/__init__.py | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+--- 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
diff --git a/debian/patches/series b/debian/patches/series
index 38fffac..9cf518f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
01_use-system-ca-certificates.patch
-02_use-system-chardet-and-urllib3.patch
03_export-IncompleteRead.patch
-04_make-requests.packages.urllib3-same-as-urllib3.patch
+05_upstream_devendorize.patch