From cab01774eaddf417ff90df11bdab672aa30001be Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Fri, 28 Oct 2016 11:27:39 -0400 Subject: [PATCH] Do not optionally load C dependencies in requests (#4035) --- pip/_vendor/README.rst | 1 + pip/_vendor/requests/__init__.py | 12 +++++++----- pip/_vendor/requests/compat.py | 14 ++++++++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/pip/_vendor/README.rst b/pip/_vendor/README.rst index a9cddb114c5..4a27bf09c36 100644 --- a/pip/_vendor/README.rst +++ b/pip/_vendor/README.rst @@ -105,6 +105,7 @@ Modifications * pkg_resources has been modified to import its externs from pip._vendor * CacheControl has been modified to import its dependencies from pip._vendor * packaging has been modified to import its dependencies from pip._vendor +* requests has been modified *not* to optionally load any C dependencies. Debundling diff --git a/pip/_vendor/requests/__init__.py b/pip/_vendor/requests/__init__.py index 82c0f78074a..103d9fd8d67 100644 --- a/pip/_vendor/requests/__init__.py +++ b/pip/_vendor/requests/__init__.py @@ -49,11 +49,13 @@ __copyright__ = 'Copyright 2016 Kenneth Reitz' # Attempt to enable urllib3's SNI support, if possible -try: - from .packages.urllib3.contrib import pyopenssl - pyopenssl.inject_into_urllib3() -except ImportError: - pass +# Note: Patched by pip to prevent using the PyOpenSSL module. On Windows this +# prevents upgrading cryptography. +# try: +# from .packages.urllib3.contrib import pyopenssl +# pyopenssl.inject_into_urllib3() +# except ImportError: +# pass import warnings diff --git a/pip/_vendor/requests/compat.py b/pip/_vendor/requests/compat.py index 70edff78495..eb7a4bfda25 100644 --- a/pip/_vendor/requests/compat.py +++ b/pip/_vendor/requests/compat.py @@ -21,12 +21,14 @@ #: Python 3.x? is_py3 = (_ver[0] == 3) -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 +# 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 # --------- # Specifics