mirror of https://github.com/pypa/pip
Do not use InstallRequirement in warn_deprecated_install_options
This only needed a list of requirements, so give it just that.
This commit is contained in:
parent
779d8df5e6
commit
9c58aa7eb5
|
@ -302,7 +302,7 @@ class InstallCommand(RequirementCommand):
|
|||
)
|
||||
|
||||
warn_deprecated_install_options(
|
||||
requirement_set, options.install_options
|
||||
reqs, options.install_options
|
||||
)
|
||||
|
||||
preparer = self.make_requirement_preparer(
|
||||
|
@ -607,8 +607,8 @@ def decide_user_install(
|
|||
return True
|
||||
|
||||
|
||||
def warn_deprecated_install_options(requirement_set, options):
|
||||
# type: (RequirementSet, Optional[List[str]]) -> None
|
||||
def warn_deprecated_install_options(requirements, options):
|
||||
# type: (List[InstallRequirement], Optional[List[str]]) -> None
|
||||
"""If any location-changing --install-option arguments were passed for
|
||||
requirements or on the command-line, then show a deprecation warning.
|
||||
"""
|
||||
|
@ -616,8 +616,6 @@ def warn_deprecated_install_options(requirement_set, options):
|
|||
# type: (Iterable[str]) -> List[str]
|
||||
return ["--{}".format(name.replace("_", "-")) for name in option_names]
|
||||
|
||||
requirements = requirement_set.all_requirements
|
||||
|
||||
offenders = []
|
||||
|
||||
for requirement in requirements:
|
||||
|
|
|
@ -10,7 +10,6 @@ from pip._internal.commands.install import (
|
|||
warn_deprecated_install_options,
|
||||
)
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
from pip._internal.req.req_set import RequirementSet
|
||||
|
||||
|
||||
class TestDecideUserInstall:
|
||||
|
@ -47,8 +46,7 @@ class TestDecideUserInstall:
|
|||
|
||||
def test_deprecation_notice_for_pip_install_options(recwarn):
|
||||
install_options = ["--prefix=/hello"]
|
||||
req_set = RequirementSet()
|
||||
warn_deprecated_install_options(req_set, install_options)
|
||||
warn_deprecated_install_options([], install_options)
|
||||
|
||||
assert len(recwarn) == 1
|
||||
message = recwarn[0].message.args[0]
|
||||
|
@ -57,21 +55,20 @@ def test_deprecation_notice_for_pip_install_options(recwarn):
|
|||
|
||||
def test_deprecation_notice_for_requirement_options(recwarn):
|
||||
install_options = []
|
||||
req_set = RequirementSet()
|
||||
|
||||
bad_named_req_options = {"install_options": ["--home=/wow"]}
|
||||
bad_named_req = InstallRequirement(
|
||||
Requirement("hello"), "requirements.txt", options=bad_named_req_options
|
||||
)
|
||||
req_set.add_named_requirement(bad_named_req)
|
||||
|
||||
bad_unnamed_req_options = {"install_options": ["--install-lib=/lib"]}
|
||||
bad_unnamed_req = InstallRequirement(
|
||||
None, "requirements2.txt", options=bad_unnamed_req_options
|
||||
)
|
||||
req_set.add_unnamed_requirement(bad_unnamed_req)
|
||||
|
||||
warn_deprecated_install_options(req_set, install_options)
|
||||
warn_deprecated_install_options(
|
||||
[bad_named_req, bad_unnamed_req], install_options
|
||||
)
|
||||
|
||||
assert len(recwarn) == 1
|
||||
message = recwarn[0].message.args[0]
|
||||
|
|
Loading…
Reference in New Issue