diff options
author | Illia Volochii <illia.volochii@gmail.com> | 2021-07-23 12:03:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 17:03:53 +0800 |
commit | 0fb0e3b54743a0810ba72929e49db822b8eb56cc (patch) | |
tree | e0d6873d3755952158a22086c538bb8cfcea3efe /tools | |
parent | c5abdda6fe7221647d698e1134ffcb9387b7d776 (diff) | |
download | pip-0fb0e3b54743a0810ba72929e49db822b8eb56cc.tar.gz |
Upgrade vendored requests to 2.26.0 (#10174)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/vendoring/patches/requests.patch | 71 |
1 files changed, 64 insertions, 7 deletions
diff --git a/tools/vendoring/patches/requests.patch b/tools/vendoring/patches/requests.patch index 08795ad3a..d1bb4309b 100644 --- a/tools/vendoring/patches/requests.patch +++ b/tools/vendoring/patches/requests.patch @@ -1,12 +1,24 @@ diff --git a/src/pip/_vendor/requests/packages.py b/src/pip/_vendor/requests/packages.py -index 6336a07d..9582fa73 100644 +index 0f8ae0d38..9582fa730 100644 --- a/src/pip/_vendor/requests/packages.py +++ b/src/pip/_vendor/requests/packages.py -@@ -4,11 +4,13 @@ import sys +@@ -1,26 +1,16 @@ + import sys + +-try: +- from pip._vendor import chardet +-except ImportError: +- import charset_normalizer as chardet +- import warnings +- +- warnings.filterwarnings('ignore', 'Trying to detect', module='charset_normalizer') +- + # This code exists for backwards compatibility reasons. # I don't like it either. Just look the other way. :) - for package in ('urllib3', 'idna', 'chardet'): +-for package in ('urllib3', 'idna'): - locals()[package] = __import__(package) ++for package in ('urllib3', 'idna', 'chardet'): + vendored_package = "pip._vendor." + package + locals()[package] = __import__(vendored_package) # This traversal is apparently necessary such that the identities are @@ -18,13 +30,29 @@ index 6336a07d..9582fa73 100644 + unprefixed_mod = mod[len("pip._vendor."):] + sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod] +-target = chardet.__name__ +-for mod in list(sys.modules): +- if mod == target or mod.startswith(target + '.'): +- sys.modules['requests.packages.' + target.replace(target, 'chardet')] = sys.modules[mod] # Kinda cool, though, right? diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__init__.py -index dc83261a8..517458b5a 100644 +index 973497f5e..4f80e28fc 100644 --- a/src/pip/_vendor/requests/__init__.py +++ b/src/pip/_vendor/requests/__init__.py -@@ -94,6 +94,11 @@ except (AssertionError, ValueError): +@@ -44,10 +44,7 @@ from pip._vendor import urllib3 + import warnings + from .exceptions import RequestsDependencyWarning + +-try: +- from charset_normalizer import __version__ as charset_normalizer_version +-except ImportError: +- charset_normalizer_version = None ++charset_normalizer_version = None + + try: + from pip._vendor.chardet import __version__ as chardet_version +@@ -107,6 +104,11 @@ except (AssertionError, ValueError): # if the standard library doesn't support SNI or the # 'ssl' library isn't available. try: @@ -38,10 +66,22 @@ index dc83261a8..517458b5a 100644 except ImportError: diff --git a/src/pip/_vendor/requests/compat.py b/src/pip/_vendor/requests/compat.py -index eb6530d..353ec29 100644 +index 409b7b028..9e2937167 100644 --- a/src/pip/_vendor/requests/compat.py +++ b/src/pip/_vendor/requests/compat.py -@@ -25,10 +25,14 @@ +@@ -8,10 +8,7 @@ This module handles import compatibility issues between Python 2 and + Python 3. + """ + +-try: +- from pip._vendor import chardet +-except ImportError: +- import charset_normalizer as chardet ++from pip._vendor import chardet + + import sys + +@@ -28,10 +25,14 @@ is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) @@ -60,3 +100,20 @@ index eb6530d..353ec29 100644 # --------- # Specifics + +diff --git a/src/pip/_vendor/requests/help.py b/src/pip/_vendor/requests/help.py +index 3a843404c..745f0d7b3 100644 +--- a/src/pip/_vendor/requests/help.py ++++ b/src/pip/_vendor/requests/help.py +@@ -11,10 +11,7 @@ from pip._vendor import urllib3 + + from . import __version__ as requests_version + +-try: +- import charset_normalizer +-except ImportError: +- charset_normalizer = None ++charset_normalizer = None + + try: + from pip._vendor import chardet |