Skip to content

Commit d9e3341

Browse files
rgommersFFY00
authored andcommitted
BUG: also handle macOS 10.X versions correctly
This is a follow-up to gh-161 Signed-off-by: Filipe Laíns <[email protected]>
1 parent 25b8d28 commit d9e3341

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

mesonpy/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,11 @@ def platform_tag(self) -> str:
275275
# latter specifies the target macOS version Python was built
276276
# against.
277277
parts[1] = platform.mac_ver()[0]
278-
# Only pick up the major version
279-
# https://github.com/FFY00/meson-python/issues/160
280-
parts[1] = parts[1].split('.')[0]
278+
if parts[1] >= '11':
279+
# Only pick up the major version, which changed from 10.X
280+
# to X.0 from macOS 11 onwards. See
281+
# https://github.com/FFY00/meson-python/issues/160
282+
parts[1] = parts[1].split('.')[0]
281283

282284
if parts[1] in ('11', '12'):
283285
# Workaround for bug where pypa/packaging does not consider macOS

tests/test_wheel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
platform_ = sysconfig.get_platform()
5252
if platform.system() == 'Darwin':
5353
parts = platform_.split('-')
54-
parts[1] = platform.mac_ver()[0].split('.')[0]
54+
if parts[1] >= '11':
55+
parts[1] = platform.mac_ver()[0].split('.')[0]
5556
if parts[1] in ('11', '12'):
5657
parts[1] += '.0'
5758
platform_ = '-'.join(parts)

0 commit comments

Comments
 (0)