Skip to content

Commit

Permalink
BUG: use 11.0 as minimum macOS platform ABI tag on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolodi committed Nov 5, 2023
1 parent 5285d4a commit 214b04e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mesonpy/_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ def _get_macosx_platform_tag() -> str:
# can therefore ignore the issue and generate the slightly
# incorrect tag.

# The minimum macOS ABI version on arm64 is 11.0. The macOS SDK
# or arm64 silently bumps any compatibility version specified via
# the MACOSX_DEPLOYMENT_TARGET environment variable to 11.0.
# Depsite the platform ABI tag being intended to be a minimum
# compatibiloty version, pip refuses to install wheels with a
# platform tag specifying ABI compatibility version lower than
# 11.0. Use 11.0 as minimum ABI version on arm64.
if arch == 'arm64' and version < (11, 0):
version = (11, 0)

major, minor = version

if major >= 11:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ def test_macos_platform_tag(monkeypatch):
assert next(packaging.tags.mac_platforms((major, minor))) == mesonpy._tags.get_platform_tag()


@pytest.mark.skipif(sys.platform != 'darwin', reason='macOS specific test')
def test_macos_platform_tag_arm64(monkeypatch):
monkeypatch.setenv('_PYTHON_HOST_PLATFORM', 'macosx-12.0-arm64')
# Verify that the minimum platform ABI version on arm64 is 11.0.
monkeypatch.setenv('MACOSX_DEPLOYMENT_TARGET', '10.12')
assert mesonpy._tags.get_platform_tag() == 'macosx_11_0_arm64'
monkeypatch.setenv('MACOSX_DEPLOYMENT_TARGET', '12.34')
assert mesonpy._tags.get_platform_tag() == 'macosx_12_0_arm64'


@pytest.mark.skipif(sys.platform != 'darwin', reason='macOS specific test')
def test_python_host_platform(monkeypatch):
monkeypatch.setenv('_PYTHON_HOST_PLATFORM', 'macosx-12.0-arm64')
Expand Down

0 comments on commit 214b04e

Please sign in to comment.