Skip to content

Commit

Permalink
fix: tests and corrected pypy mins
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Jun 7, 2024
1 parent 043a17b commit e706535
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
8 changes: 5 additions & 3 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,15 @@ def setup_python(
# Set MACOSX_DEPLOYMENT_TARGET, if the user didn't set it.
# For arm64, the minimal deployment target is 11.0.
# On x86_64 (or universal2), use 10.9 as a default.
# PyPy needs 10.10. CPython 3.13 needs 10.13.
# CPython 3.13 needs 10.13.
if config_is_arm64:
default_target = "11.0"
elif Version(python_configuration.version) >= Version("3.13"):
default_target = "10.13"
elif python_configuration.identifier.startswith("pp"):
default_target = "10.10"
elif python_configuration.identifier.startswith("pp") and Version(
python_configuration.version
) >= Version("3.9"):
default_target = "10.15"
else:
default_target = "10.9"
env.setdefault("MACOSX_DEPLOYMENT_TARGET", default_target)
Expand Down
27 changes: 16 additions & 11 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,11 @@ def cibuildwheel_run(
return wheels


def _get_arm64_macosx_deployment_target(macosx_deployment_target: str) -> str:
def _floor_macosx_deployment_target(*args: str) -> str:
"""
The first version of macOS that supports arm is 11.0. So the wheel tag
cannot contain an earlier deployment target, even if
MACOSX_DEPLOYMENT_TARGET sets it.
Make sure a deployment target is not less than some value.
"""
version_tuple = tuple(map(int, macosx_deployment_target.split(".")))
if version_tuple <= (11, 0):
return "11.0"
else:
return macosx_deployment_target
return max(args, key=lambda x: tuple(map(int, x.split("."))))


def expected_wheels(
Expand Down Expand Up @@ -282,11 +276,22 @@ def expected_wheels(

elif platform == "macos":
if machine_arch == "arm64":
arm64_macosx_deployment_target = _get_arm64_macosx_deployment_target(
macosx_deployment_target
arm64_macosx_deployment_target = _floor_macosx_deployment_target(
macosx_deployment_target, "11.0"
)
platform_tags = [f'macosx_{arm64_macosx_deployment_target.replace(".", "_")}_arm64']
else:
if python_abi_tag.startswith("pp") and not python_abi_tag.startswith(
("pp37", "pp38")
):
macosx_deployment_target = _floor_macosx_deployment_target(
macosx_deployment_target, "10.15"
)
elif python_abi_tag.startswith("cp3.13"):
macosx_deployment_target = _floor_macosx_deployment_target(
macosx_deployment_target, "10.13"
)

platform_tags = [f'macosx_{macosx_deployment_target.replace(".", "_")}_x86_64']

if include_universal2:
Expand Down

0 comments on commit e706535

Please sign in to comment.