From 88f8e3f61b2e117e53a1d655c191034812a0b94e Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 8 Sep 2024 18:49:44 +0200 Subject: [PATCH] fix: set minimal deployment target to macOS 10.13 with CPython 3.12 --- cibuildwheel/macos.py | 4 ++-- test/utils.py | 30 ++++++++++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 75be2023b..63e7296b4 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -294,10 +294,10 @@ 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. - # CPython 3.13 needs 10.13. + # CPython 3.12.6+ needs 10.13. if config_is_arm64: default_target = "11.0" - elif Version(python_configuration.version) >= Version("3.13"): + elif Version(python_configuration.version) >= Version("3.12"): default_target = "10.13" elif python_configuration.identifier.startswith("pp") and Version( python_configuration.version diff --git a/test/utils.py b/test/utils.py index fbf4d17ee..158527e81 100644 --- a/test/utils.py +++ b/test/utils.py @@ -274,25 +274,27 @@ def expected_wheels( platform_tags = ["win32", "win_amd64"] elif platform == "macos": + if python_abi_tag.startswith("pp"): + if python_abi_tag.startswith(("pp37", "pp38")): + min_macosx = macosx_deployment_target + else: + min_macosx = _floor_macosx(macosx_deployment_target, "10.15") + elif python_abi_tag.startswith("cp"): + if python_abi_tag.startswith(("cp36", "cp37", "cp38", "cp39", "cp310", "cp311")): + min_macosx = macosx_deployment_target + else: + min_macosx = _floor_macosx(macosx_deployment_target, "10.13") + else: + min_macosx = macosx_deployment_target + if machine_arch == "arm64": - arm64_macosx = _floor_macosx(macosx_deployment_target, "11.0") + arm64_macosx = _floor_macosx(min_macosx, "11.0") platform_tags = [f'macosx_{arm64_macosx.replace(".", "_")}_arm64'] else: - if python_abi_tag.startswith("pp") and not python_abi_tag.startswith( - ("pp37", "pp38") - ): - pypy_macosx = _floor_macosx(macosx_deployment_target, "10.15") - platform_tags = [f'macosx_{pypy_macosx.replace(".", "_")}_x86_64'] - elif python_abi_tag.startswith("cp313"): - pypy_macosx = _floor_macosx(macosx_deployment_target, "10.13") - platform_tags = [f'macosx_{pypy_macosx.replace(".", "_")}_x86_64'] - else: - platform_tags = [f'macosx_{macosx_deployment_target.replace(".", "_")}_x86_64'] + platform_tags = [f'macosx_{min_macosx.replace(".", "_")}_x86_64'] if include_universal2: - platform_tags.append( - f'macosx_{macosx_deployment_target.replace(".", "_")}_universal2', - ) + platform_tags.append(f'macosx_{min_macosx.replace(".", "_")}_universal2') else: msg = f"Unsupported platform {platform!r}" raise Exception(msg)