Skip to content

Commit

Permalink
fix: set SYSTEM_VERSION_COMPAT=0 during pip install on macos (#1768)
Browse files Browse the repository at this point in the history
* Set SYSTEM_VERSION_COMPAT=0 during pip install on macos (#1767)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Only set SYSTEM_VERSION_COMPAT=0 for CPython 3.8

* Set SYSTEM_VERSION_COMPAT=0 for CPython <= 3.8

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cibuildwheel/macos.py

Co-authored-by: Joe Rickerby <joerick@mac.com>

* Update cibuildwheel/macos.py

Co-authored-by: Joe Rickerby <joerick@mac.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
  • Loading branch information
3 people committed Mar 11, 2024
1 parent 87fff77 commit e2a0839
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,17 +583,37 @@ def build(options: Options, tmp_path: Path) -> None:
shell_with_arch(before_test_prepared, env=virtualenv_env)

# install the wheel
if is_cp38 and python_arch == "x86_64":
virtualenv_env_install_wheel = virtualenv_env.copy()
virtualenv_env_install_wheel["SYSTEM_VERSION_COMPAT"] = "0"
log.notice(
unwrap(
"""
Setting SYSTEM_VERSION_COMPAT=0 to ensure CPython 3.8 can get
correct macOS version and allow installation of wheels with
MACOSX_DEPLOYMENT_TARGET >= 11.0.
See https://github.com/pypa/cibuildwheel/issues/1767 for the
details.
"""
)
)
else:
virtualenv_env_install_wheel = virtualenv_env

call_with_arch(
"pip",
"install",
f"{repaired_wheel}{build_options.test_extras}",
env=virtualenv_env,
env=virtualenv_env_install_wheel,
)

# test the wheel
if build_options.test_requires:
call_with_arch(
"pip", "install", *build_options.test_requires, env=virtualenv_env
"pip",
"install",
*build_options.test_requires,
env=virtualenv_env_install_wheel,
)

# run the tests from a temp dir, with an absolute path in the command
Expand Down

0 comments on commit e2a0839

Please sign in to comment.