Skip to content

Commit d01aeaa

Browse files
authored
Merge pull request #8369 from sbidoul/deprecate-pip-install-on-bdist_wheel-failure
2 parents d2eb0ef + d924b16 commit d01aeaa

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

news/8368.removal

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deprecate legacy setup.py install when building a wheel failed for source
2+
distributions without pyproject.toml

src/pip/_internal/commands/install.py

+30-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
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
2425
from pip._internal.utils.distutils_args import parse_distutils_args
2526
from pip._internal.utils.filesystem import test_writable_dir
2627
from pip._internal.utils.misc import (
@@ -355,18 +356,38 @@ def run(self, options, args):
355356

356357
# If we're using PEP 517, we cannot do a direct install
357358
# so we fail here.
358-
# We don't care about failures building legacy
359-
# requirements, as we'll fall through to a direct
360-
# install for those.
361-
pep517_build_failures = [
362-
r for r in build_failures if r.use_pep517
363-
]
364-
if pep517_build_failures:
359+
pep517_build_failure_names = [
360+
r.name # type: ignore
361+
for r in build_failures if r.use_pep517
362+
] # type: List[str]
363+
if pep517_build_failure_names:
365364
raise InstallationError(
366365
"Could not build wheels for {} which use"
367366
" PEP 517 and cannot be installed directly".format(
368-
", ".join(r.name # type: ignore
369-
for r in pep517_build_failures)))
367+
", ".join(pep517_build_failure_names)
368+
)
369+
)
370+
371+
# For now, we just warn about failures building legacy
372+
# requirements, as we'll fall through to a direct
373+
# 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+
)
370391

371392
to_install = resolver.get_installation_order(
372393
requirement_set

src/pip/_internal/wheel_builder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _should_build(
8080
if not req.use_pep517 and not is_wheel_installed():
8181
# we don't build legacy requirements if wheel is not installed
8282
logger.info(
83-
"Using legacy setup.py install for %s, "
83+
"Using legacy 'setup.py install' for %s, "
8484
"since package 'wheel' is not installed.", req.name,
8585
)
8686
return False

0 commit comments

Comments
 (0)