]>
Commit | Line | Data |
---|---|---|
e0df8241 JR |
1 | import sys |
2 | ||
3 | # This code exists for backwards compatibility reasons. | |
4 | # I don't like it either. Just look the other way. :) | |
5 | ||
6 | for package in ('urllib3', 'idna', 'chardet'): | |
7 | vendored_package = "pip._vendor." + package | |
8 | locals()[package] = __import__(vendored_package) | |
9 | # This traversal is apparently necessary such that the identities are | |
10 | # preserved (requests.packages.urllib3.* is urllib3.*) | |
11 | for mod in list(sys.modules): | |
12 | if mod == vendored_package or mod.startswith(vendored_package + '.'): | |
13 | unprefixed_mod = mod[len("pip._vendor."):] | |
14 | sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod] | |
15 | ||
16 | # Kinda cool, though, right? |