Skip to content

Commit 0b18e21

Browse files
authored
Merge pull request #8752 from sbidoul/imp-8369-deprecation-sbi
2 parents b7075b9 + 4c348cf commit 0b18e21

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

news/8752.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Make the ``setup.py install`` deprecation warning less noisy. We warn only
2+
when ``setup.py install`` succeeded and ``setup.py bdist_wheel`` failed, as
3+
situations where both fails are most probably irrelevant to this deprecation.

src/pip/_internal/commands/install.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from pip._internal.operations.check import check_install_conflicts
2222
from pip._internal.req import install_given_reqs
2323
from pip._internal.req.req_tracker import get_requirement_tracker
24-
from pip._internal.utils.deprecation import deprecated
2524
from pip._internal.utils.distutils_args import parse_distutils_args
2625
from pip._internal.utils.filesystem import test_writable_dir
2726
from pip._internal.utils.misc import (
@@ -371,23 +370,9 @@ def run(self, options, args):
371370
# For now, we just warn about failures building legacy
372371
# requirements, as we'll fall through to a direct
373372
# install for those.
374-
legacy_build_failure_names = [
375-
r.name # type: ignore
376-
for r in build_failures if not r.use_pep517
377-
] # type: List[str]
378-
if legacy_build_failure_names:
379-
deprecated(
380-
reason=(
381-
"Could not build wheels for {} which do not use "
382-
"PEP 517. pip will fall back to legacy 'setup.py "
383-
"install' for these.".format(
384-
", ".join(legacy_build_failure_names)
385-
)
386-
),
387-
replacement="to fix the wheel build issue reported above",
388-
gone_in="21.0",
389-
issue=8368,
390-
)
373+
for r in build_failures:
374+
if not r.use_pep517:
375+
r.legacy_install_reason = 8368
391376

392377
to_install = resolver.get_installation_order(
393378
requirement_set

src/pip/_internal/req/req_install.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def __init__(
121121
self.comes_from = comes_from
122122
self.constraint = constraint
123123
self.editable = editable
124+
self.legacy_install_reason = None # type: Optional[int]
124125

125126
# source_dir is the local directory where the linked requirement is
126127
# located, or unpacked. In case unpacking is needed, creating and
@@ -853,6 +854,18 @@ def install(
853854

854855
self.install_succeeded = success
855856

857+
if success and self.legacy_install_reason == 8368:
858+
deprecated(
859+
reason=(
860+
"{} was installed using the legacy 'setup.py install' "
861+
"method, because a wheel could not be built for it.".
862+
format(self.name)
863+
),
864+
replacement="to fix the wheel build issue reported above",
865+
gone_in="21.0",
866+
issue=8368,
867+
)
868+
856869

857870
def check_invalid_constraint_type(req):
858871
# type: (InstallRequirement) -> str

0 commit comments

Comments
 (0)