Skip to content

Commit ae802e3

Browse files
committed
Deprecate setup.py install fallback when wheel package is absent
1 parent afe136c commit ae802e3

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

news/8559.removal.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deprecate installation with 'setup.py install' when the 'wheel' package is absent for
2+
source distributions without 'pyproject.toml'.

src/pip/_internal/req/req_install.py

+5
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,11 @@ def install(
811811
install_options = list(install_options) + self.install_options
812812

813813
try:
814+
if (
815+
self.legacy_install_reason is not None
816+
and self.legacy_install_reason.emit_before_install
817+
):
818+
self.legacy_install_reason.emit_deprecation(self.name)
814819
success = install_legacy(
815820
install_options=install_options,
816821
global_options=global_options,

src/pip/_internal/utils/deprecation.py

+14
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,17 @@ def emit_deprecation(self, name: str) -> None:
159159
issue=8368,
160160
emit_after_success=True,
161161
)
162+
163+
164+
LegacyInstallReasonMissingWheelPackage = LegacyInstallReason(
165+
reason=(
166+
"{name} is being installed using the legacy "
167+
"'setup.py install' method, because it does not have a "
168+
"'pyproject.toml' and the 'wheel' package "
169+
"is not installed."
170+
),
171+
replacement="to enable the '--use-pep517' option",
172+
gone_in=None,
173+
issue=8559,
174+
emit_before_install=True,
175+
)

src/pip/_internal/wheel_builder.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pip._internal.operations.build.wheel_editable import build_wheel_editable
2020
from pip._internal.operations.build.wheel_legacy import build_wheel_legacy
2121
from pip._internal.req.req_install import InstallRequirement
22+
from pip._internal.utils.deprecation import LegacyInstallReasonMissingWheelPackage
2223
from pip._internal.utils.logging import indent_log
2324
from pip._internal.utils.misc import ensure_dir, hash_file, is_wheel_installed
2425
from pip._internal.utils.setuptools_build import make_setuptools_clean_args
@@ -86,11 +87,7 @@ def _should_build(
8687

8788
if not is_wheel_installed():
8889
# we don't build legacy requirements if wheel is not installed
89-
logger.info(
90-
"Using legacy 'setup.py install' for %s, "
91-
"since package 'wheel' is not installed.",
92-
req.name,
93-
)
90+
req.legacy_install_reason = LegacyInstallReasonMissingWheelPackage
9491
return False
9592

9693
return True

0 commit comments

Comments
 (0)