Skip to content

Commit d7ba123

Browse files
pipcl.py: avoid unsupported macos wheel names.
In platform tag, we now don't attempt to replace universal2 with x86_64 or arm64, because pip can refuse to handle the resulting wheel name. It seems that allowed arm64 values are more restrictive than universal2.
1 parent 8f34325 commit d7ba123

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pipcl.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,15 +2619,18 @@ def _macos_fixup_platform_tag(tag):
26192619
26202620
E.g. `foo-1.2.3-cp311-none-macosx_13_x86_64.whl` causes `pip` to fail with:
26212621
`not a supported wheel on this platform`. We seem to need to add `_0` to
2622-
the OS version.
2622+
the OS version. (This is documented at
2623+
https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#macos).
26232624
2624-
And we replace trailing `universal2` with x86_64 or arm64, because we don't
2625-
create universal wheels.
2625+
And with graal we need to replace trailing `universal2` with x86_64
2626+
or arm64. On non-graal this causes problems because non-universal
2627+
platform tags seem more restricted than platform tags from
2628+
sysconfig.get_platform(). For example:
26262629
2627-
>>> pt = _macos_fixup_platform_tag('macosx_10_13_universal2')
2628-
>>> assert pt == f'macosx_10_13_{platform.machine()}'
2629-
>>> pt = _macos_fixup_platform_tag('macosx_13_universal2')
2630-
>>> assert pt == f'macosx_13_0_{platform.machine()}', f'{pt=}'
2630+
pip install ...-macosx_10_13_arm64.whl
2631+
ERROR: ...-macosx_10_13_arm64.whl is not a supported wheel on this platform.
2632+
pip install ...-macosx_10_13_universal2.whl
2633+
Ok.
26312634
'''
26322635
m = re.match( '^macosx_([0-9_]+)_([^0-9].+)$', tag)
26332636
if not m:
@@ -2636,8 +2639,8 @@ def _macos_fixup_platform_tag(tag):
26362639
if '_' not in a:
26372640
a += '_0'
26382641
b = m.group(2)
2639-
if b == 'universal2':
2640-
# Replace with x86_64 or arm64.
2642+
if sys.implementation.name == 'graalpy' and b == 'universal2':
2643+
# Replace 'universal2' with x86_64 or arm64.
26412644
b = platform.machine()
26422645
ret = f'macosx_{a}_{b}'
26432646
#log0(f'Changing from {tag=} to {ret=}.')

0 commit comments

Comments
 (0)