未验证 提交 2634beb2 编写于 作者: P Paul Moore 提交者: GitHub

Merge pull request #5090 from philpennock/master

Keep install options in requirements.txt from leaking
Keep install options in requirements.txt from leaking.
......@@ -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')
......
......@@ -513,3 +513,37 @@ def test_install_unsupported_wheel_file(script, data):
assert ("simple.dist-0.1-py1-none-invalid.whl is not a supported " +
"wheel on this platform" in result.stderr)
assert len(result.files_created) == 0
def test_install_options_local_to_package(script, data):
"""Make sure --install-options does not leak across packages.
A requirements.txt file can have per-package --install-options; these
should be isolated to just the package instead of leaking to subsequent
packages. This needs to be a functional test because the bug was around
cross-contamination at install time.
"""
home_simple = script.scratch_path.join("for-simple")
test_simple = script.scratch.join("for-simple")
home_simple.mkdir()
reqs_file = script.scratch_path.join("reqs.txt")
reqs_file.write(
textwrap.dedent("""
simple --install-option='--home=%s'
INITools
""" % home_simple))
result = script.pip(
'install',
'--no-index', '-f', data.find_links,
'-r', reqs_file,
expect_error=True,
)
simple = test_simple / 'lib' / 'python' / 'simple'
bad = test_simple / 'lib' / 'python' / 'initools'
good = script.site_packages / 'initools'
assert simple in result.files_created
assert result.files_created[simple].dir
assert bad not in result.files_created
assert good in result.files_created
assert result.files_created[good].dir
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册