From 462d6ca5904f934f66c62db640ee2d5e08b9bdea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 31 May 2020 14:01:29 +0200 Subject: [PATCH 1/3] Deprecate install fallback when bdist_wheel fails --- news/8368.removal | 2 ++ src/pip/_internal/commands/install.py | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 news/8368.removal diff --git a/news/8368.removal b/news/8368.removal new file mode 100644 index 00000000000..646c384d78a --- /dev/null +++ b/news/8368.removal @@ -0,0 +1,2 @@ +Deprecate legacy setup.py install when building a wheel failed for source +distributions without pyproject.toml diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index ac60aa53196..384099ae60d 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -21,6 +21,7 @@ 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 ( @@ -355,9 +356,6 @@ def run(self, options, args): # If we're using PEP 517, we cannot do a direct install # so we fail here. - # We don't care about failures building legacy - # requirements, as we'll fall through to a direct - # install for those. pep517_build_failures = [ r for r in build_failures if r.use_pep517 ] @@ -368,6 +366,26 @@ def run(self, options, args): ", ".join(r.name # type: ignore for r in pep517_build_failures))) + # For now, we just warn about failures building legacy + # requirements, as we'll fall through to a direct + # install for those. + legacy_build_failures = [ + r for r in build_failures if not r.use_pep517 + ] + if legacy_build_failures: + 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(r.name for r in legacy_build_failures) + ) + ), + replacement="to fix the wheel build issue reported above", + gone_in="21.0", + issue=8368, + ) + to_install = resolver.get_installation_order( requirement_set ) From fe5682627a5b0897ec2c6abe2360eb0ca46a1132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 31 May 2020 19:52:31 +0200 Subject: [PATCH 2/3] Quote 'setup.py install' when calling it legacy We want to make it clear that it is the setup.py install command we consider legacy, not setup.py itself. --- src/pip/_internal/commands/install.py | 4 ++-- src/pip/_internal/wheel_builder.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 384099ae60d..7ed6a05acf0 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -376,8 +376,8 @@ def run(self, options, args): 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( + "PEP 517. pip will fall back to legacy 'setup.py " + "install' for these.".format( ", ".join(r.name for r in legacy_build_failures) ) ), diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py index b9929815810..fa08016bdfb 100644 --- a/src/pip/_internal/wheel_builder.py +++ b/src/pip/_internal/wheel_builder.py @@ -80,7 +80,7 @@ def _should_build( if not req.use_pep517 and not is_wheel_installed(): # we don't build legacy requirements if wheel is not installed logger.info( - "Using legacy setup.py install for %s, " + "Using legacy 'setup.py install' for %s, " "since package 'wheel' is not installed.", req.name, ) return False From d924b16b0db39c316176027260d06c4c8f6f22de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 18 Jul 2020 13:45:23 +0200 Subject: [PATCH 3/3] Give mypy some love after rebase --- src/pip/_internal/commands/install.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 7ed6a05acf0..454c0b70c4c 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -356,29 +356,32 @@ def run(self, options, args): # If we're using PEP 517, we cannot do a direct install # so we fail here. - pep517_build_failures = [ - r for r in build_failures if r.use_pep517 - ] - if pep517_build_failures: + pep517_build_failure_names = [ + r.name # type: ignore + for r in build_failures if r.use_pep517 + ] # type: List[str] + if pep517_build_failure_names: raise InstallationError( "Could not build wheels for {} which use" " PEP 517 and cannot be installed directly".format( - ", ".join(r.name # type: ignore - for r in pep517_build_failures))) + ", ".join(pep517_build_failure_names) + ) + ) # For now, we just warn about failures building legacy # requirements, as we'll fall through to a direct # install for those. - legacy_build_failures = [ - r for r in build_failures if not r.use_pep517 - ] - if legacy_build_failures: + 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(r.name for r in legacy_build_failures) + ", ".join(legacy_build_failure_names) ) ), replacement="to fix the wheel build issue reported above",