From 24b087f6d8a8692f1a997ba6b88d7322978da6c5 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 3 Oct 2022 12:54:50 +0200 Subject: [PATCH] BUG: also handle macOS 10.X versions correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a follow-up to gh-161 Signed-off-by: Filipe LaĆ­ns --- mesonpy/__init__.py | 8 +++++--- tests/test_wheel.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index fe417b378..f723113f5 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -275,9 +275,11 @@ def platform_tag(self) -> str: # latter specifies the target macOS version Python was built # against. parts[1] = platform.mac_ver()[0] - # Only pick up the major version - # https://github.com/FFY00/meson-python/issues/160 - parts[1] = parts[1].split('.')[0] + if parts[1] >= '11': + # Only pick up the major version, which changed from 10.X + # to X.0 from macOS 11 onwards. See + # https://github.com/FFY00/meson-python/issues/160 + parts[1] = parts[1].split('.')[0] if parts[1] in ('11', '12'): # Workaround for bug where pypa/packaging does not consider macOS diff --git a/tests/test_wheel.py b/tests/test_wheel.py index c2700e286..818367f13 100644 --- a/tests/test_wheel.py +++ b/tests/test_wheel.py @@ -51,7 +51,9 @@ platform_ = sysconfig.get_platform() if platform.system() == 'Darwin': parts = platform_.split('-') - parts[1] = platform.mac_ver()[0].split('.')[0] + parts[1] = platform.mac_ver()[0] + if parts[1] >= '11': + parts[1] = parts[1].split('.')[0] if parts[1] in ('11', '12'): parts[1] += '.0' platform_ = '-'.join(parts)