Skip to content

Commit

Permalink
Deprecate --no-binary implying setup.py install
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Sep 17, 2022
1 parent bad03ef commit f39d386
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions news/11452.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate installation with 'setup.py install' when no-binary is enabled for
source distributions without 'pyproject.toml'.
17 changes: 15 additions & 2 deletions src/pip/_internal/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class LegacyInstallReason:
def __init__(
self,
reason: str,
replacement: Optional[str],
gone_in: Optional[str],
replacement: Optional[str] = None,
gone_in: Optional[str] = None,
feature_flag: Optional[str] = None,
issue: Optional[int] = None,
emit_after_success: bool = False,
Expand Down Expand Up @@ -173,3 +173,16 @@ def emit_deprecation(self, name: str) -> None:
issue=8559,
emit_before_install=True,
)

LegacyInstallReasonNoBinaryForcesSetuptoolsInstall = LegacyInstallReason(
reason=(
"{name} is being installed using the legacy "
"'setup.py install' method, because the '--no-binary' option was enabled "
"for it and this currently disables local wheel building for projects that "
"don't have a 'pyproject.toml' file."
),
replacement="to enable the '--use-pep517' option",
gone_in="23.1",
issue=11451,
emit_before_install=True,
)
10 changes: 5 additions & 5 deletions src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
from pip._internal.operations.build.wheel_editable import build_wheel_editable
from pip._internal.operations.build.wheel_legacy import build_wheel_legacy
from pip._internal.req.req_install import InstallRequirement
from pip._internal.utils.deprecation import LegacyInstallReasonMissingWheelPackage
from pip._internal.utils.deprecation import (
LegacyInstallReasonMissingWheelPackage,
LegacyInstallReasonNoBinaryForcesSetuptoolsInstall,
)
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed
from pip._internal.utils.setuptools_build import make_setuptools_clean_args
Expand Down Expand Up @@ -80,10 +83,7 @@ def _should_build(

assert check_bdist_wheel is not None
if not check_bdist_wheel(req):
logger.info(
"Skipping wheel build for %s, due to binaries being disabled for it.",
req.name,
)
req.legacy_install_reason = LegacyInstallReasonNoBinaryForcesSetuptoolsInstall
return False

if not is_wheel_installed():
Expand Down

0 comments on commit f39d386

Please sign in to comment.