allow manylinux compatibility override via _manylinux module. (#6039)

## Summary
resolves https://github.com/astral-sh/uv/issues/5915, not entirely sure
if `manylinux_compatible` should be a separate field in the JSON
returned by the interpreter or there's some way to use the existing
`platform` for it.

## Test Plan
ran the below
```
rm -rf .venv
target/debug/uv venv
# commenting out the line below triggers the change..
# target/debug/uv pip install no-manylinux
target/debug/uv pip install cryptography --no-cache
```

is there an easy way to add this into the existing snapshot-based test
suite? looking around to see if there's a way that doesn't involve
something implementation-dependent like mocks.

~update: i think the output does differ between these two, so probably
we can use that.~ i lied - that "building..." output seems to be
discarded.
This commit is contained in:
Chan Kang 2024-08-20 21:57:42 -04:00 committed by GitHub
parent 2e02d579a0
commit c9774e9c43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 128 additions and 4 deletions

View file

@ -542,6 +542,17 @@ def main() -> None:
"python_version": ".".join(platform.python_version_tuple()[:2]),
"sys_platform": sys.platform,
}
os_and_arch = get_operating_system_and_architecture()
manylinux_compatible = True
if os_and_arch["os"]["name"] == "manylinux":
# noinspection PyProtectedMember
from .packaging._manylinux import _get_glibc_version, _is_compatible
manylinux_compatible = _is_compatible(
arch=os_and_arch["arch"], version=_get_glibc_version()
)
interpreter_info = {
"result": "success",
"markers": markers,
@ -554,7 +565,8 @@ def main() -> None:
"stdlib": sysconfig.get_path("stdlib"),
"scheme": get_scheme(),
"virtualenv": get_virtualenv(),
"platform": get_operating_system_and_architecture(),
"platform": os_and_arch,
"manylinux_compatible": manylinux_compatible,
# The `t` abiflag for freethreading Python.
# https://peps.python.org/pep-0703/#build-configuration-changes
"gil_disabled": bool(sysconfig.get_config_var("Py_GIL_DISABLED")),