|
19 | 19 |
|
20 | 20 |
|
21 | 21 | 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 |
29 | 41 |
|
30 | 42 |
|
31 | 43 | package_dir = pathlib.Path(__file__).parent / 'packages'
|
|
0 commit comments