Skip to content

Commit 5cdddb2

Browse files
authored
fix: error message when manylinux-interpreters ensure ... failed (#2066)
* review: address review comments from #1630 * fix: error message when `manylinux-interpreters ensure ...` failed * fix: error message when `manylinux-interpreters ensure ...` failed (option b)
1 parent e18a6e9 commit 5cdddb2

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

cibuildwheel/linux.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import contextlib
34
import subprocess
45
import sys
56
import textwrap
@@ -133,26 +134,33 @@ def check_all_python_exist(
133134
*, platform_configs: Iterable[PythonConfiguration], container: OCIContainer
134135
) -> None:
135136
exist = True
136-
has_manylinux_interpreters = True
137+
has_manylinux_interpreters = False
137138
messages = []
138139

139-
try:
140+
with contextlib.suppress(subprocess.CalledProcessError):
140141
# use capture_output to keep quiet
141142
container.call(["manylinux-interpreters", "--help"], capture_output=True)
142-
except subprocess.CalledProcessError:
143-
has_manylinux_interpreters = False
143+
has_manylinux_interpreters = True
144144

145145
for config in platform_configs:
146146
python_path = config.path / "bin" / "python"
147-
try:
148-
if has_manylinux_interpreters:
147+
if has_manylinux_interpreters:
148+
try:
149149
container.call(["manylinux-interpreters", "ensure", config.path.name])
150-
container.call(["test", "-x", python_path])
151-
except subprocess.CalledProcessError:
152-
messages.append(
153-
f" '{python_path}' executable doesn't exist in image '{container.image}' to build '{config.identifier}'."
154-
)
155-
exist = False
150+
except subprocess.CalledProcessError:
151+
messages.append(
152+
f" 'manylinux-interpreters ensure {config.path.name}' needed to build '{config.identifier}' failed in container running image '{container.image}'."
153+
" Either the installation failed or this interpreter is not available in that image. Please check the logs."
154+
)
155+
exist = False
156+
else:
157+
try:
158+
container.call(["test", "-x", python_path])
159+
except subprocess.CalledProcessError:
160+
messages.append(
161+
f" '{python_path}' executable doesn't exist in image '{container.image}' to build '{config.identifier}'."
162+
)
163+
exist = False
156164
if not exist:
157165
message = "\n".join(messages)
158166
raise errors.FatalError(message)

0 commit comments

Comments
 (0)