diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 744c0840e..eb648c4a6 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -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) diff --git a/test/utils.py b/test/utils.py index 5cd5158f5..5ecc98f56 100644 --- a/test/utils.py +++ b/test/utils.py @@ -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( @@ -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: