Skip to content

Commit

Permalink
fix: fail macOS CPython install when running locally
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Dec 29, 2021
1 parent 583d5f7 commit 810c5a7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cibuildwheel/macos.py
Expand Up @@ -22,6 +22,7 @@
BuildSelector,
NonPlatformWheelError,
call,
detect_ci_provider,
download,
get_build_verbosity_extra_flags,
get_pip_version,
Expand Down Expand Up @@ -86,6 +87,17 @@ def install_cpython(version: str, url: str) -> Path:
installation_path = Path(f"/Library/Frameworks/Python.framework/Versions/{version}")

if python_package_identifier not in installed_system_packages:
if detect_ci_provider() is None:
# if running locally, we don't want to install CPython with sudo
# let the user know & provide a link to the installer
print(
f"Error: CPython {version} is not installed.\n"
"cibuildwheel will not perform system-wide installs when running outside of CI.\n"
f"To build locally, install CPython {version} on this machine, or, disable this version of Python using CIBW_SKIP=cp{version.replace('.', '')}-macosx_*\n"
f"\nDownload link: {url}",
file=sys.stderr,
)
raise SystemExit(1)
# download the pkg
download(url, Path("/tmp/Python.pkg"))
# install
Expand Down

0 comments on commit 810c5a7

Please sign in to comment.