pip/tools/automation/vendoring/patches/requests.patch

63 lines
2.4 KiB
Diff
Raw Normal View History

2017-11-04 08:18:43 +01:00
diff --git a/src/pip/_vendor/requests/packages.py b/src/pip/_vendor/requests/packages.py
index 6336a07d..9582fa73 100644
2017-11-04 08:18:43 +01:00
--- a/src/pip/_vendor/requests/packages.py
+++ b/src/pip/_vendor/requests/packages.py
@@ -4,11 +4,13 @@ import sys
2017-11-04 08:18:43 +01:00
# I don't like it either. Just look the other way. :)
for package in ('urllib3', 'idna', 'chardet'):
- locals()[package] = __import__(package)
+ vendored_package = "pip._vendor." + package
+ locals()[package] = __import__(vendored_package)
2017-11-04 08:18:43 +01:00
# This traversal is apparently necessary such that the identities are
# preserved (requests.packages.urllib3.* is urllib3.*)
for mod in list(sys.modules):
- if mod == package or mod.startswith(package + '.'):
- sys.modules['requests.packages.' + mod] = sys.modules[mod]
+ if mod == vendored_package or mod.startswith(vendored_package + '.'):
+ unprefixed_mod = mod[len("pip._vendor."):]
+ sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod]
# Kinda cool, though, right?
2017-11-04 08:18:43 +01:00
diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__init__.py
2020-07-22 01:38:53 +02:00
index dc83261a8..517458b5a 100644
--- a/src/pip/_vendor/requests/__init__.py
+++ b/src/pip/_vendor/requests/__init__.py
2020-07-22 01:38:53 +02:00
@@ -94,6 +94,11 @@ except (AssertionError, ValueError):
# if the standard library doesn't support SNI or the
# 'ssl' library isn't available.
try:
+ # Note: This logic prevents upgrading cryptography on Windows, if imported
+ # as part of pip.
+ from pip._internal.utils.compat import WINDOWS
+ if not WINDOWS:
+ raise ImportError("pip internals: don't import cryptography on Windows")
try:
import ssl
except ImportError:
diff --git a/src/pip/_vendor/requests/compat.py b/src/pip/_vendor/requests/compat.py
2016-11-06 23:34:10 +01:00
index eb6530d..353ec29 100644
--- a/src/pip/_vendor/requests/compat.py
+++ b/src/pip/_vendor/requests/compat.py
2017-09-07 18:32:59 +02:00
@@ -25,10 +25,14 @@
2016-11-06 23:34:10 +01:00
#: Python 3.x?
is_py3 = (_ver[0] == 3)
2017-09-07 18:32:59 +02:00
2016-11-06 23:34:10 +01:00
-try:
- import simplejson as json
2017-09-07 18:32:59 +02:00
-except ImportError:
2016-11-06 23:34:10 +01:00
- import json
+# Note: We've patched out simplejson support in pip because it prevents
+# upgrading simplejson on Windows.
+# try:
+# import simplejson as json
+# except (ImportError, SyntaxError):
+# # simplejson does not support Python 3.2, it throws a SyntaxError
+# # because of u'...' Unicode literals.
+import json
2017-09-07 18:32:59 +02:00
2016-11-06 23:34:10 +01:00
# ---------
# Specifics