Skip to content

Commit

Permalink
Merge pull request #8369 from sbidoul/deprecate-pip-install-on-bdist_…
Browse files Browse the repository at this point in the history
…wheel-failure
  • Loading branch information
pradyunsg authored Jul 18, 2020
2 parents d2eb0ef + d924b16 commit d01aeaa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
2 changes: 2 additions & 0 deletions news/8368.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate legacy setup.py install when building a wheel failed for source
distributions without pyproject.toml
39 changes: 30 additions & 9 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d01aeaa

Please sign in to comment.