Skip to content
Myr

Merge branch 'debian-imports' of https://github.com/untitaker/requests into proposed/2.8.0

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ian Cordasco · committed by Ian Cordasco · parents 5ec7576, 93216af · Browse files · 2 files+39 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+39 added−3 removed

  • other:+39 added−3 removed

2 files+39 added−3 removed

modified:requests/packages/__init__.py+34 added-1 removed
1'''2Debian and other distributions "unbundle" requests' vendored dependencies, and3rewrite all imports to use the global versions of ``urllib3`` and ``chardet``.4The problem with this is that not only requests itself imports those5dependencies, but third-party code outside of the distros' control too.67In reaction to these problems, the distro maintainers replaced8``requests.packages`` with a magical "stub module" that imports the correct9modules. The implementations were varying in quality and all had severe10problems. For example, a symlink (or hardlink) that links the correct modules11into place introduces problems regarding object identity, since you now have12two modules in `sys.modules` with the same API, but different identities::1314 requests.packages.urllib3 is not urllib31516With version ``2.5.2``, requests started to maintain its own stub, so that17distro-specific breakage would be reduced to a minimum, even though the whole18issue is not requests' fault in the first place. See19https://github.com/kennethreitz/requests/pull/2375 for the corresponding pull20request.21'''2223from __future__ import absolute_import24import sys2526try:3from . import urllib327 from . import urllib328except ImportError:29 import urllib330 sys.modules['%s.urllib3' % __name__] = urllib33132try:33 from . import chardet34except ImportError:35 import chardet36 sys.modules['%s.chardet' % __name__] = chardet
modified:requests/packages/README.rst+5 added-2 removed
1If you are planning to submit a pull request to requests with any changes in 2this library do not go any further. These are independent libraries which we 3vendor into requests. Any changes necessary to these libraries must be made in 2this library do not go any further. These are independent libraries which we3vendor into requests. Any changes necessary to these libraries must be made in4them and submitted as separate pull requests to those libraries.56urllib3 pull requests go here: https://github.com/shazow/urllib378chardet pull requests go here: https://github.com/chardet/chardet910See https://github.com/kennethreitz/requests/pull/1812#issuecomment-3085431611for the reasoning behind this.