Skip to content

Commit 18f54c0

Browse files
authored
docs: print a couple slighly more detailed error messages (#2044)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 5b7119e commit 18f54c0

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

cibuildwheel/errors.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ def __init__(self) -> None:
3535
"""
3636
Build failed because a pure Python wheel was generated.
3737
38-
If you intend to build a pure-Python wheel, you don't need cibuildwheel - use
39-
`pip wheel -w DEST_DIR .` instead.
40-
41-
If you expected a platform wheel, check your project configuration, or run
42-
cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs.
38+
If you intend to build a pure-Python wheel, you don't need
39+
cibuildwheel - use `pip wheel .`, `pipx run build --wheel`, `uv
40+
build --wheel`, etc. instead. You only need cibuildwheel if you
41+
have compiled (not Python) code in your wheels making them depend
42+
on the platform.
43+
44+
If you expected a platform wheel, check your project configuration,
45+
or run cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs.
4346
"""
4447
)
4548
super().__init__(message)

cibuildwheel/macos.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import functools
4+
import inspect
45
import os
56
import platform
67
import re
@@ -149,11 +150,15 @@ def install_cpython(tmp: Path, version: str, url: str, free_threading: bool) ->
149150
if detect_ci_provider() is None:
150151
# if running locally, we don't want to install CPython with sudo
151152
# let the user know & provide a link to the installer
152-
msg = (
153-
f"Error: CPython {version} is not installed.\n"
154-
"cibuildwheel will not perform system-wide installs when running outside of CI.\n"
155-
f"To build locally, install CPython {version} on this machine, or, disable this version of Python using CIBW_SKIP=cp{version.replace('.', '')}-macosx_*\n"
156-
f"\nDownload link: {url}"
153+
msg = inspect.cleandoc(
154+
f"""
155+
Error: CPython {version} is not installed.
156+
cibuildwheel will not perform system-wide installs when running outside of CI.
157+
To build locally, install CPython {version} on this machine, or, disable this
158+
version of Python using CIBW_SKIP=cp{version.replace('.', '')}-macosx_*
159+
For portable builds, cibuildwheel needs the official builds from python.org.
160+
Download link: {url}
161+
"""
157162
)
158163
raise errors.FatalError(msg)
159164
pkg_path = tmp / "Python.pkg"

0 commit comments

Comments
 (0)