Skip to content

Commit

Permalink
fix: error message when manylinux-interpreters ensure ... failed (p…
Browse files Browse the repository at this point in the history
…ypa#2066)

* review: address review comments from pypa#1630

* fix: error message when `manylinux-interpreters ensure ...` failed

* fix: error message when `manylinux-interpreters ensure ...` failed (option b)
  • Loading branch information
mayeut authored Nov 9, 2024
1 parent e18a6e9 commit 5cdddb2
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions cibuildwheel/linux.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import contextlib
import subprocess
import sys
import textwrap
Expand Down Expand Up @@ -133,26 +134,33 @@ def check_all_python_exist(
*, platform_configs: Iterable[PythonConfiguration], container: OCIContainer
) -> None:
exist = True
has_manylinux_interpreters = True
has_manylinux_interpreters = False
messages = []

try:
with contextlib.suppress(subprocess.CalledProcessError):
# use capture_output to keep quiet
container.call(["manylinux-interpreters", "--help"], capture_output=True)
except subprocess.CalledProcessError:
has_manylinux_interpreters = False
has_manylinux_interpreters = True

for config in platform_configs:
python_path = config.path / "bin" / "python"
try:
if has_manylinux_interpreters:
if has_manylinux_interpreters:
try:
container.call(["manylinux-interpreters", "ensure", config.path.name])
container.call(["test", "-x", python_path])
except subprocess.CalledProcessError:
messages.append(
f" '{python_path}' executable doesn't exist in image '{container.image}' to build '{config.identifier}'."
)
exist = False
except subprocess.CalledProcessError:
messages.append(
f" 'manylinux-interpreters ensure {config.path.name}' needed to build '{config.identifier}' failed in container running image '{container.image}'."
" Either the installation failed or this interpreter is not available in that image. Please check the logs."
)
exist = False
else:
try:
container.call(["test", "-x", python_path])
except subprocess.CalledProcessError:
messages.append(
f" '{python_path}' executable doesn't exist in image '{container.image}' to build '{config.identifier}'."
)
exist = False
if not exist:
message = "\n".join(messages)
raise errors.FatalError(message)
Expand Down

0 comments on commit 5cdddb2

Please sign in to comment.