mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #11873 from sbidoul/simplify-check_legacy_setup_py_options
Simplify check_legacy_setup_py_options
This commit is contained in:
commit
711b5ac6fd
|
@ -8,10 +8,7 @@ from pip._internal.cli.cmdoptions import make_target_python
|
|||
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
|
||||
from pip._internal.cli.status_codes import SUCCESS
|
||||
from pip._internal.operations.build.build_tracker import get_build_tracker
|
||||
from pip._internal.req.req_install import (
|
||||
LegacySetupPyOptionsCheckMode,
|
||||
check_legacy_setup_py_options,
|
||||
)
|
||||
from pip._internal.req.req_install import check_legacy_setup_py_options
|
||||
from pip._internal.utils.misc import ensure_dir, normalize_path, write_output
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
|
||||
|
@ -109,9 +106,7 @@ class DownloadCommand(RequirementCommand):
|
|||
)
|
||||
|
||||
reqs = self.get_requirements(args, options, finder, session)
|
||||
check_legacy_setup_py_options(
|
||||
options, reqs, LegacySetupPyOptionsCheckMode.DOWNLOAD
|
||||
)
|
||||
check_legacy_setup_py_options(options, reqs)
|
||||
|
||||
preparer = self.make_requirement_preparer(
|
||||
temp_build_dir=directory,
|
||||
|
|
|
@ -27,7 +27,6 @@ from pip._internal.operations.check import ConflictDetails, check_install_confli
|
|||
from pip._internal.req import install_given_reqs
|
||||
from pip._internal.req.req_install import (
|
||||
InstallRequirement,
|
||||
LegacySetupPyOptionsCheckMode,
|
||||
check_legacy_setup_py_options,
|
||||
)
|
||||
from pip._internal.utils.compat import WINDOWS
|
||||
|
@ -345,9 +344,7 @@ class InstallCommand(RequirementCommand):
|
|||
|
||||
try:
|
||||
reqs = self.get_requirements(args, options, finder, session)
|
||||
check_legacy_setup_py_options(
|
||||
options, reqs, LegacySetupPyOptionsCheckMode.INSTALL
|
||||
)
|
||||
check_legacy_setup_py_options(options, reqs)
|
||||
|
||||
if "no-binary-enable-wheel-cache" in options.features_enabled:
|
||||
# TODO: remove format_control from WheelCache when the deprecation cycle
|
||||
|
|
|
@ -12,7 +12,6 @@ from pip._internal.exceptions import CommandError
|
|||
from pip._internal.operations.build.build_tracker import get_build_tracker
|
||||
from pip._internal.req.req_install import (
|
||||
InstallRequirement,
|
||||
LegacySetupPyOptionsCheckMode,
|
||||
check_legacy_setup_py_options,
|
||||
)
|
||||
from pip._internal.utils.deprecation import deprecated
|
||||
|
@ -122,9 +121,7 @@ class WheelCommand(RequirementCommand):
|
|||
)
|
||||
|
||||
reqs = self.get_requirements(args, options, finder, session)
|
||||
check_legacy_setup_py_options(
|
||||
options, reqs, LegacySetupPyOptionsCheckMode.WHEEL
|
||||
)
|
||||
check_legacy_setup_py_options(options, reqs)
|
||||
|
||||
if "no-binary-enable-wheel-cache" in options.features_enabled:
|
||||
# TODO: remove format_control from WheelCache when the deprecation cycle
|
||||
|
|
|
@ -8,7 +8,6 @@ import shutil
|
|||
import sys
|
||||
import uuid
|
||||
import zipfile
|
||||
from enum import Enum
|
||||
from optparse import Values
|
||||
from typing import Any, Collection, Dict, Iterable, List, Optional, Sequence, Union
|
||||
|
||||
|
@ -888,26 +887,16 @@ def _has_option(options: Values, reqs: List[InstallRequirement], option: str) ->
|
|||
return False
|
||||
|
||||
|
||||
class LegacySetupPyOptionsCheckMode(Enum):
|
||||
INSTALL = 1
|
||||
WHEEL = 2
|
||||
DOWNLOAD = 3
|
||||
|
||||
|
||||
def check_legacy_setup_py_options(
|
||||
options: Values,
|
||||
reqs: List[InstallRequirement],
|
||||
mode: LegacySetupPyOptionsCheckMode,
|
||||
) -> None:
|
||||
has_build_options = _has_option(options, reqs, "build_options")
|
||||
has_global_options = _has_option(options, reqs, "global_options")
|
||||
legacy_setup_py_options_present = has_build_options or has_global_options
|
||||
if not legacy_setup_py_options_present:
|
||||
return
|
||||
|
||||
options.format_control.disallow_binaries()
|
||||
logger.warning(
|
||||
"Implying --no-binary=:all: due to the presence of "
|
||||
"--build-option / --global-option. "
|
||||
"Consider using --config-settings for more flexibility.",
|
||||
)
|
||||
if has_build_options or has_global_options:
|
||||
logger.warning(
|
||||
"Implying --no-binary=:all: due to the presence of "
|
||||
"--build-option / --global-option. "
|
||||
"Consider using --config-settings for more flexibility.",
|
||||
)
|
||||
options.format_control.disallow_binaries()
|
||||
|
|
Loading…
Reference in a new issue