Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions micropip/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,31 @@ def platform_to_version(platform: str) -> str:
for tag in tags:
if tag.abi in abis:
abi_incompatible = False
break
break
if abi_incompatible:
abis_string = ",".join({tag.abi for tag in tags})
raise ValueError(
f"Wheel abi '{abis_string}' is not supported. Supported abis are 'abi3' and 'cp{version}'."
)

raise ValueError(f"Wheel interpreter version '{tag.interpreter}' is not supported.")
# Check interpreter compatibility
current_version = int(version)
for tag in tags:
try:
wheel_version = int(tag.interpreter.removeprefix("cp"))
# abi3: forward compatible (wheel_version <= current_version)
# non-abi3: exact match required (wheel_version == current_version)
if (tag.abi == "abi3" and wheel_version <= current_version) or (
tag.abi != "abi3" and wheel_version == current_version
):
return
except ValueError:
continue

interpreters_string = ",".join({tag.interpreter for tag in tags})
raise ValueError(
f"Wheel interpreter version '{interpreters_string}' is not supported."
)


def validate_constraints(
Expand Down