summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhil Pennock <phil@pennock-tech.com>2018-03-19 20:30:09 -0400
committerPhil Pennock <phil@pennock-tech.com>2018-03-20 16:23:34 -0400
commit23cd8f689948d2741bb7e3df2b69020c4b88251f (patch)
tree56b416fb9856727e05cc6b79c20a62a2e5d95a05 /src
parent8dbdb74a6d2d431642c520b5c30cb45226a0add2 (diff)
downloadpip-23cd8f689948d2741bb7e3df2b69020c4b88251f.tar.gz
Keep install options in requirements.txt from leaking
The list of install options passed into the setup routine is mutable, passed by reference, so adding items for "this package" to that list mutates the options for all subsequent packages. Isolate the lists before mutating them. Includes a functional test, which has been confirmed to fail without this fix. Fixes #3763 Fixes #4453 Fixes #5089
Diffstat (limited to 'src')
-rw-r--r--src/pip/_internal/req/req_install.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 889fe1d39..8d4f9ef46 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -771,11 +771,13 @@ class InstallRequirement(object):
# Options specified in requirements file override those
# specified on the command line, since the last option given
# to setup.py is the one that is used.
- global_options += self.options.get('global_options', [])
- install_options += self.options.get('install_options', [])
+ global_options = list(global_options) + \
+ self.options.get('global_options', [])
+ install_options = list(install_options) + \
+ self.options.get('install_options', [])
if self.isolated:
- global_options = list(global_options) + ["--no-user-cfg"]
+ global_options = global_options + ["--no-user-cfg"]
with TempDirectory(kind="record") as temp_dir:
record_filename = os.path.join(temp_dir.path, 'install-record.txt')