mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-30 07:17:26 +00:00
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:
parent
2e02d579a0
commit
c9774e9c43
7 changed files with 128 additions and 4 deletions
|
@ -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")),
|
||||
|
|
|
@ -33,6 +33,7 @@ pub struct Interpreter {
|
|||
markers: Box<MarkerEnvironment>,
|
||||
scheme: Scheme,
|
||||
virtualenv: Scheme,
|
||||
manylinux_compatible: bool,
|
||||
sys_prefix: PathBuf,
|
||||
sys_base_exec_prefix: PathBuf,
|
||||
sys_base_prefix: PathBuf,
|
||||
|
@ -63,6 +64,7 @@ impl Interpreter {
|
|||
markers: Box::new(info.markers),
|
||||
scheme: info.scheme,
|
||||
virtualenv: info.virtualenv,
|
||||
manylinux_compatible: info.manylinux_compatible,
|
||||
sys_prefix: info.sys_prefix,
|
||||
sys_base_exec_prefix: info.sys_base_exec_prefix,
|
||||
pointer_size: info.pointer_size,
|
||||
|
@ -176,6 +178,7 @@ impl Interpreter {
|
|||
self.python_tuple(),
|
||||
self.implementation_name(),
|
||||
self.implementation_tuple(),
|
||||
self.manylinux_compatible,
|
||||
self.gil_disabled,
|
||||
)?;
|
||||
self.tags.set(tags).expect("tags should not be set");
|
||||
|
@ -373,6 +376,11 @@ impl Interpreter {
|
|||
&self.virtualenv
|
||||
}
|
||||
|
||||
/// Return whether this interpreter is `manylinux` compatible.
|
||||
pub fn manylinux_compatible(&self) -> bool {
|
||||
self.manylinux_compatible
|
||||
}
|
||||
|
||||
/// Return the [`PointerSize`] of the Python interpreter (i.e., 32- vs. 64-bit).
|
||||
pub fn pointer_size(&self) -> PointerSize {
|
||||
self.pointer_size
|
||||
|
@ -555,6 +563,7 @@ struct InterpreterInfo {
|
|||
markers: MarkerEnvironment,
|
||||
scheme: Scheme,
|
||||
virtualenv: Scheme,
|
||||
manylinux_compatible: bool,
|
||||
sys_prefix: PathBuf,
|
||||
sys_base_exec_prefix: PathBuf,
|
||||
sys_base_prefix: PathBuf,
|
||||
|
@ -785,6 +794,7 @@ mod tests {
|
|||
},
|
||||
"arch": "x86_64"
|
||||
},
|
||||
"manylinux_compatible": false,
|
||||
"markers": {
|
||||
"implementation_name": "cpython",
|
||||
"implementation_version": "3.12.0",
|
||||
|
|
|
@ -210,6 +210,7 @@ mod tests {
|
|||
},
|
||||
"arch": "x86_64"
|
||||
},
|
||||
"manylinux_compatible": true,
|
||||
"markers": {
|
||||
"implementation_name": "{IMPLEMENTATION}",
|
||||
"implementation_version": "{FULL_VERSION}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue