Skip to content

Commit 5142149

Browse files
committed
TST: reconcile platform tags with recent packaging on macOS
1 parent 6a5a511 commit 5142149

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

tests/conftest.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,25 @@
1919

2020

2121
def adjust_packaging_platform_tag(platform: str) -> str:
22-
# The packaging module generates overly specific platforms tags on
23-
# Linux. The platforms tags on Linux evolved over time.
24-
# meson-python uses more relaxed platform tags to maintain
25-
# compatibility with old wheel installation tools. The relaxed
26-
# platform tags match the ones generated by the wheel package.
27-
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
28-
return re.sub(r'^(many|musl)linux(1|2010|2014|_\d+_\d+)_(.*)$', r'linux_\3', platform)
22+
if platform.startswith(('manylinux', 'musllinux')):
23+
# The packaging module generates overly specific platforms tags on
24+
# Linux. The platforms tags on Linux evolved over time.
25+
# meson-python uses more relaxed platform tags to maintain
26+
# compatibility with old wheel installation tools. The relaxed
27+
# platform tags match the ones generated by the wheel package.
28+
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
29+
return re.sub(r'^(many|musl)linux(1|2010|2014|_\d+_\d+)_(.*)$', r'linux_\3', platform)
30+
if platform.startswith('macosx'):
31+
# Python built with older macOS SDK on macOS 11, reports an
32+
# unexising macOS 10.16 version instead of the real version.
33+
# The packaging module introduced a workaround in version
34+
# 22.0. Too maintain compatibility with older packaging
35+
# releases we don't implement it. Reconcile this.
36+
from platform import mac_ver
37+
version = tuple(map(int, mac_ver()[0].split('.')))[:2]
38+
if version == (10, 16):
39+
return re.sub(r'^macosx_\d+_\d+_(.*)$', r'macosx_10_16_\1', platform)
40+
return platform
2941

3042

3143
package_dir = pathlib.Path(__file__).parent / 'packages'

0 commit comments

Comments
 (0)