|
4 | 4 | import os
|
5 | 5 | import os.path
|
6 | 6 | import pathlib
|
| 7 | +import platform |
7 | 8 | import re
|
8 | 9 | import shutil
|
9 | 10 | import subprocess
|
|
19 | 20 |
|
20 | 21 |
|
21 | 22 | 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) |
| 23 | + if platform.startswith(('manylinux', 'musllinux')): |
| 24 | + # The packaging module generates overly specific platforms tags on |
| 25 | + # Linux. The platforms tags on Linux evolved over time. |
| 26 | + # meson-python uses more relaxed platform tags to maintain |
| 27 | + # compatibility with old wheel installation tools. The relaxed |
| 28 | + # platform tags match the ones generated by the wheel package. |
| 29 | + # https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/ |
| 30 | + return re.sub(r'^(many|musl)linux(1|2010|2014|_\d+_\d+)_(.*)$', r'linux_\3', platform) |
| 31 | + if platform.startwith('macosx'): |
| 32 | + # Python built with older macOS SDK on macOS 11, reports an |
| 33 | + # unexising macOS 10.16 version instead of the real version. |
| 34 | + # The packaging module introduced a workaround in version |
| 35 | + # 22.0. Too maintain compatibility with older packaging |
| 36 | + # releases we don't implement it. Reconcile this. |
| 37 | + version = tuple(map(int, platform.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