1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Improve deprecation message for issue 8368

This commit is contained in:
Stéphane Bidoul 2020-08-12 11:07:36 +02:00
parent ea10d0e253
commit 9c4a88b0a0
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
2 changed files with 16 additions and 18 deletions

View file

@ -21,7 +21,6 @@ from pip._internal.locations import distutils_scheme
from pip._internal.operations.check import check_install_conflicts
from pip._internal.req import install_given_reqs
from pip._internal.req.req_tracker import get_requirement_tracker
from pip._internal.utils.deprecation import deprecated
from pip._internal.utils.distutils_args import parse_distutils_args
from pip._internal.utils.filesystem import test_writable_dir
from pip._internal.utils.misc import (
@ -371,23 +370,9 @@ class InstallCommand(RequirementCommand):
# For now, we just warn about failures building legacy
# requirements, as we'll fall through to a direct
# install for those.
legacy_build_failure_names = [
r.name # type: ignore
for r in build_failures if not r.use_pep517
] # type: List[str]
if legacy_build_failure_names:
deprecated(
reason=(
"Could not build wheels for {} which do not use "
"PEP 517. pip will fall back to legacy 'setup.py "
"install' for these.".format(
", ".join(legacy_build_failure_names)
)
),
replacement="to fix the wheel build issue reported above",
gone_in="21.0",
issue=8368,
)
for r in build_failures:
if not r.use_pep517:
r.legacy_install_reason = 8368
to_install = resolver.get_installation_order(
requirement_set

View file

@ -121,6 +121,7 @@ class InstallRequirement(object):
self.comes_from = comes_from
self.constraint = constraint
self.editable = editable
self.legacy_install_reason = None # type: Optional[int]
# source_dir is the local directory where the linked requirement is
# located, or unpacked. In case unpacking is needed, creating and
@ -859,6 +860,18 @@ class InstallRequirement(object):
except Exception:
self.install_succeeded = True
raise
else:
if self.legacy_install_reason == 8368:
deprecated(
reason=(
"{} was installed using the legacy 'setup.py install' "
"method, because a wheel could not be built for it.".
format(self.name)
),
replacement="to fix the wheel build issue reported above",
gone_in="21.0",
issue=8368,
)
self.install_succeeded = success