Make build_wheels return all failures

Check for PEP 517 build failures by
filtering failures.
This commit is contained in:
Stéphane Bidoul (ACSONE) 2019-12-29 17:54:18 +01:00
parent 8784fb419a
commit 8601bb5d06
No known key found for this signature in database
GPG Key ID: BCAB2555446B5B92
1 changed files with 11 additions and 7 deletions

View File

@ -82,14 +82,12 @@ def build_wheels(
# type: (...) -> BuildResult
"""
Build wheels for requirements, depending on whether wheel is installed.
Return failures only for PEP 517 requirements.
"""
# We don't build wheels for legacy requirements if wheel is not installed.
should_build_legacy = is_wheel_installed()
# Always build PEP 517 requirements
pep517_build_successes, build_failures = builder.build(
pep517_build_successes, pep517_build_failures = builder.build(
pep517_requirements,
should_unpack=True,
wheel_cache=wheel_cache,
@ -102,7 +100,7 @@ def build_wheels(
# We don't care about failures building legacy
# requirements, as we'll fall through to a direct
# install for those.
legacy_build_successes, _ = builder.build(
legacy_build_successes, legacy_build_failures = builder.build(
legacy_requirements,
should_unpack=True,
wheel_cache=wheel_cache,
@ -111,7 +109,10 @@ def build_wheels(
check_binary_allowed=check_binary_allowed,
)
return pep517_build_successes + legacy_build_successes, build_failures
return (
pep517_build_successes + legacy_build_successes,
pep517_build_failures + legacy_build_failures,
)
def get_check_binary_allowed(format_control):
@ -423,11 +424,14 @@ class InstallCommand(RequirementCommand):
# If we're using PEP 517, we cannot do a direct install
# so we fail here.
if build_failures:
pep517_build_failures = [
r for r in build_failures if r.use_pep517
]
if pep517_build_failures:
raise InstallationError(
"Could not build wheels for {} which use"
" PEP 517 and cannot be installed directly".format(
", ".join(r.name for r in build_failures)))
", ".join(r.name for r in pep517_build_failures)))
to_install = resolver.get_installation_order(
requirement_set