diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2014-02-04 13:02:36 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2014-02-04 13:02:36 (GMT) |
commit | 6edd82a1d25bb941ebb5f5e98690ddc2ddbbd79e (patch) | |
tree | 6388877441889873b89608d9e9542aba4ba7a3eb /Lib/ensurepip | |
parent | a9b15241c6bdf8ac71f1dc598b7c01a20518b6a7 (diff) | |
download | cpython-6edd82a1d25bb941ebb5f5e98690ddc2ddbbd79e.zip cpython-6edd82a1d25bb941ebb5f5e98690ddc2ddbbd79e.tar.gz cpython-6edd82a1d25bb941ebb5f5e98690ddc2ddbbd79e.tar.bz2 |
Close #20053: ignore default pip config settings
ensurepip now sets PIP_CONFIG_FILE to os.devnull before
import pip from the wheel file. This also ensures venv
ignores the default settings when bootstrapping pip.
Diffstat (limited to 'Lib/ensurepip')
-rw-r--r-- | Lib/ensurepip/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index fe51fde..e8d6abe 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -47,13 +47,16 @@ def version(): """ return _PIP_VERSION -def _clear_pip_environment_variables(): +def _disable_pip_configuration_settings(): # We deliberately ignore all pip environment variables # when invoking pip # See http://bugs.python.org/issue19734 for details keys_to_remove = [k for k in os.environ if k.startswith("PIP_")] for k in keys_to_remove: del os.environ[k] + # We also ignore the settings in the default pip configuration file + # See http://bugs.python.org/issue20053 for details + os.environ['PIP_CONFIG_FILE'] = os.devnull def bootstrap(*, root=None, upgrade=False, user=False, @@ -69,7 +72,7 @@ def bootstrap(*, root=None, upgrade=False, user=False, raise ValueError("Cannot use altinstall and default_pip together") _require_ssl_for_pip() - _clear_pip_environment_variables() + _disable_pip_configuration_settings() # By default, installing pip and setuptools installs all of the # following scripts (X.Y == running Python version): @@ -130,7 +133,7 @@ def _uninstall_helper(*, verbosity=0): raise RuntimeError(msg.format(pip.__version__, _PIP_VERSION)) _require_ssl_for_pip() - _clear_pip_environment_variables() + _disable_pip_configuration_settings() # Construct the arguments to be passed to the pip command args = ["uninstall", "-y"] |