diff --git a/src/dep_logic/tags/platform.py b/src/dep_logic/tags/platform.py index 6caf6a7..7772867 100644 --- a/src/dep_logic/tags/platform.py +++ b/src/dep_logic/tags/platform.py @@ -35,7 +35,7 @@ def parse(cls, platform: str) -> Self: Available operating systems: - `linux`: an alias for `manylinux_2_17_x86_64` - `windows`: an alias for `win_amd64` - - `macos`: an alias for `macos_12_0_arm64` + - `macos`: an alias for `macos_14_0_arm64` - `alpine`: an alias for `musllinux_1_2_x86_64` - `windows_amd64` - `windows_x86` @@ -54,7 +54,7 @@ def parse(cls, platform: str) -> Self: elif platform == "windows": return cls(os.Windows(), Arch.X86_64) elif platform == "macos": - return cls(os.Macos(12, 0), Arch.Aarch64) + return cls(os.Macos(14, 0), Arch.Aarch64) elif platform == "alpine": return cls(os.Musllinux(1, 2), Arch.X86_64) elif platform.startswith("windows_"): diff --git a/src/dep_logic/tags/tags.py b/src/dep_logic/tags/tags.py index 51fb83d..eafae7e 100644 --- a/src/dep_logic/tags/tags.py +++ b/src/dep_logic/tags/tags.py @@ -167,8 +167,16 @@ def _evaluate_python( .replace("pyston", "pt") .lower() ) + allow_abi3 = impl == "cp" and ( + self.implementation is None or not self.implementation.gil_disabled + ) + free_threaded: bool | None = None + if self.implementation is not None: + free_threaded = self.implementation.gil_disabled try: - if impl == "cp" and abi_impl == "abi3": + if abi_impl == "abi3": + if not allow_abi3: + return None if ( parse_version_specifier(f">={major}.{minor or 0}") & self.requires_python @@ -178,8 +186,14 @@ def _evaluate_python( # cp36-cp36m-* # cp312-cp312m-* # pp310-pypy310_pp75-* - if abi_impl != "none" and not abi_impl.startswith(python_tag.lower()): - return None + if abi_impl != "none": + if not abi_impl.startswith(python_tag.lower()): + return None + if ( + free_threaded is not None + and abi_impl.endswith("t") is not free_threaded + ): + return None if major and minor: wheel_range = parse_version_specifier(f"=={major}.{minor}.*") else: diff --git a/tests/tags/test_platform.py b/tests/tags/test_platform.py index 1dd6f22..a384dd2 100644 --- a/tests/tags/test_platform.py +++ b/tests/tags/test_platform.py @@ -322,7 +322,7 @@ def test_platform_tags_musl(): "text,expected,normalized", [ ("linux", Platform(os.Manylinux(2, 17), Arch.X86_64), "manylinux_2_17_x86_64"), - ("macos", Platform(os.Macos(12, 0), Arch.Aarch64), "macos_12_0_arm64"), + ("macos", Platform(os.Macos(14, 0), Arch.Aarch64), "macos_14_0_arm64"), ("windows", Platform(os.Windows(), Arch.X86_64), "windows_amd64"), ("alpine", Platform(os.Musllinux(1, 2), Arch.X86_64), "musllinux_1_2_x86_64"), ( diff --git a/tests/tags/test_tags.py b/tests/tags/test_tags.py index cc4691b..d96ec3a 100644 --- a/tests/tags/test_tags.py +++ b/tests/tags/test_tags.py @@ -6,6 +6,8 @@ def test_check_wheel_tags(): wheels = [ + "protobuf-5.27.2-cp313-cp313t-macosx_14_0_arm64.whl", + "protobuf-5.27.2-cp313-cp313-macosx_14_0_arm64.whl", "protobuf-5.27.2-cp310-abi3-win32.whl", "protobuf-5.27.2-cp310-abi3-win_amd64.whl", "protobuf-5.27.2-cp310-cp310-macosx_12_0_arm64.whl", @@ -52,11 +54,26 @@ def test_check_wheel_tags(): } filtered_wheels = sorted(wheel_compats, key=wheel_compats.__getitem__, reverse=True) assert filtered_wheels == [ + "protobuf-5.27.2-cp313-cp313-macosx_14_0_arm64.whl", "protobuf-5.27.2-cp310-cp310-macosx_12_0_arm64.whl", "protobuf-5.27.2-cp38-abi3-macosx_10_9_universal2.whl", "protobuf-5.27.2-py3-none-any.whl", ] + macos_free_threaded_env = EnvSpec.from_spec(">=3.9", "macos", "cpython", True) + wheel_compats = { + f: c + for f, c in { + f: macos_free_threaded_env.wheel_compatibility(f) for f in wheels + }.items() + if c is not None + } + filtered_wheels = sorted(wheel_compats, key=wheel_compats.__getitem__, reverse=True) + assert filtered_wheels == [ + "protobuf-5.27.2-cp313-cp313t-macosx_14_0_arm64.whl", + "protobuf-5.27.2-py3-none-any.whl", + ] + python_env = EnvSpec.from_spec(">=3.9") wheel_compats = { f: c @@ -65,6 +82,8 @@ def test_check_wheel_tags(): } filtered_wheels = sorted(wheel_compats, key=wheel_compats.__getitem__, reverse=True) assert filtered_wheels == [ + "protobuf-5.27.2-cp313-cp313t-macosx_14_0_arm64.whl", + "protobuf-5.27.2-cp313-cp313-macosx_14_0_arm64.whl", "protobuf-5.27.2-cp310-cp310-macosx_12_0_arm64.whl", "protobuf-5.27.2-cp310-abi3-win32.whl", "protobuf-5.27.2-cp310-abi3-win_amd64.whl",