Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve deprecation message for issue 8368 #8752

Merged
merged 3 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions news/8752.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make the ``setup.py install`` deprecation warning less noisy. We warn only
when ``setup.py install`` succeeded and ``setup.py bdist_wheel`` failed, as
situations where both fails are most probably irrelevant to this deprecation.
21 changes: 3 additions & 18 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
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 (
Expand Down Expand Up @@ -371,23 +370,9 @@ def run(self, options, args):
# 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
Expand Down
13 changes: 13 additions & 0 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(
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
Expand Down Expand Up @@ -862,6 +863,18 @@ def install(

self.install_succeeded = success

if success and 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,
)


def check_invalid_constraint_type(req):
# type: (InstallRequirement) -> str
Expand Down