Skip to content

Commit e22047b

Browse files
authored
Convert installable wheel build error to diagnostic (#13453)
This also makes this error easier to reuse which is useful for implementing in-process build deps installation.
1 parent 8610508 commit e22047b

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/pip/_internal/commands/install.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
with_cleanup,
2828
)
2929
from pip._internal.cli.status_codes import ERROR, SUCCESS
30-
from pip._internal.exceptions import CommandError, InstallationError
30+
from pip._internal.exceptions import (
31+
CommandError,
32+
InstallationError,
33+
InstallWheelBuildError,
34+
)
3135
from pip._internal.locations import get_scheme
3236
from pip._internal.metadata import get_environment
3337
from pip._internal.models.installation_report import InstallationReport
@@ -434,12 +438,7 @@ def run(self, options: Values, args: list[str]) -> int:
434438
)
435439

436440
if build_failures:
437-
raise InstallationError(
438-
"Failed to build installable wheels for some "
439-
"pyproject.toml based projects ({})".format(
440-
", ".join(r.name for r in build_failures) # type: ignore
441-
)
442-
)
441+
raise InstallWheelBuildError(build_failures)
443442

444443
to_install = resolver.get_installation_order(requirement_set)
445444

src/pip/_internal/exceptions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,3 +865,17 @@ def __init__(self) -> None:
865865
),
866866
link="https://pip.pypa.io/en/stable/topics/dependency-resolution/#handling-resolution-too-deep-errors",
867867
)
868+
869+
870+
class InstallWheelBuildError(DiagnosticPipError):
871+
reference = "failed-wheel-build-for-install"
872+
873+
def __init__(self, failed: list[InstallRequirement]) -> None:
874+
super().__init__(
875+
message=(
876+
"Failed to build installable wheels for some "
877+
"pyproject.toml based projects"
878+
),
879+
context=", ".join(r.name for r in failed), # type: ignore
880+
hint_stmt=None,
881+
)

0 commit comments

Comments
 (0)