Skip to content

Commit d7f9792

Browse files
committed
Fix Python interpreter discovery on non-glibc hosts
When glibc cannot be found, simply return 0 for the version numbers and mark the interpreter as being incompatible with manylinux
1 parent 0e3bcb8 commit d7f9792

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/uv-python/python/get_interpreter_info.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,21 +463,19 @@ def get_operating_system_and_architecture():
463463

464464
musl_version = _get_musl_version(sys.executable)
465465
glibc_version = _get_glibc_version()
466+
466467
if musl_version:
467468
operating_system = {
468469
"name": "musllinux",
469470
"major": musl_version[0],
470471
"minor": musl_version[1],
471472
}
472-
elif glibc_version != (-1, -1):
473+
else:
473474
operating_system = {
474475
"name": "manylinux",
475476
"major": glibc_version[0],
476477
"minor": glibc_version[1],
477478
}
478-
else:
479-
print(json.dumps({"result": "error", "kind": "libc_not_found"}))
480-
sys.exit(0)
481479
elif operating_system == "win":
482480
operating_system = {
483481
"name": "windows",
@@ -542,16 +540,20 @@ def main() -> None:
542540
"python_version": ".".join(platform.python_version_tuple()[:2]),
543541
"sys_platform": sys.platform,
544542
}
543+
545544
os_and_arch = get_operating_system_and_architecture()
546545

547-
manylinux_compatible = True
546+
manylinux_compatible = False
547+
548548
if os_and_arch["os"]["name"] == "manylinux":
549549
# noinspection PyProtectedMember
550550
from .packaging._manylinux import _get_glibc_version, _is_compatible
551551

552552
manylinux_compatible = _is_compatible(
553553
arch=os_and_arch["arch"], version=_get_glibc_version()
554554
)
555+
elif os_and_arch["os"]["name"] == "musllinux":
556+
manylinux_compatible = True
555557

556558
interpreter_info = {
557559
"result": "success",

crates/uv-python/python/packaging/_manylinux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _parse_glibc_version(version_str: str) -> tuple[int, int]:
173173
def _get_glibc_version() -> tuple[int, int]:
174174
version_str = _glibc_version_string()
175175
if version_str is None:
176-
return (-1, -1)
176+
return (0, 0)
177177
return _parse_glibc_version(version_str)
178178

179179

0 commit comments

Comments
 (0)