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..454c0b70c4c 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,18 +356,38 @@ 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 - ] - 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_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, + ) to_install = resolver.get_installation_order( requirement_set 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