mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Respect the libc of the execution environment with uv python list
(#5036)
Fix #4988 ## Summary Running `uv python list` on glibc-based Linux will list musl pythons. ```bash $ uv version uv 0.2.24 $ uv python list warning: `uv python list` is experimental and may change without warning. cpython-3.12.3-linux-x86_64-musl <download available> cpython-3.12.3-linux-x86_64-gnu /usr/bin/python3 cpython-3.12.3-linux-x86_64-gnu /bin/python3 cpython-3.11.9-linux-x86_64-musl <download available> cpython-3.10.14-linux-x86_64-musl <download available> cpython-3.9.19-linux-x86_64-musl <download available> cpython-3.8.19-linux-x86_64-musl <download available> cpython-3.7.9-linux-x86_64-musl <download available> ``` Change it to show Python matching the environment's libc as follows. ```bash $ uv python list warning: `uv python list` is experimental and may change without warning. cpython-3.12.3-linux-x86_64-gnu /usr/bin/python3 cpython-3.12.3-linux-x86_64-gnu /bin/python3 cpython-3.12.3-linux-x86_64-gnu <download available> cpython-3.11.9-linux-x86_64-gnu <download available> cpython-3.10.14-linux-x86_64-gnu <download available> cpython-3.9.19-linux-x86_64-gnu <download available> cpython-3.8.19-linux-x86_64-gnu <download available> cpython-3.7.9-linux-x86_64-gnu <download available> ``` Also, if --all-platforms is specified, change to list Python for all architectures and libc. ```bash $ uv python list --all-platforms warning: `uv python list` is experimental and may change without warning. cpython-3.12.3-windows-x86_64-none <download available> cpython-3.12.3-windows-x86-none <download available> cpython-3.12.3-macos-x86_64-none <download available> cpython-3.12.3-macos-aarch64-none <download available> cpython-3.12.3-linux-x86_64-musl <download available> cpython-3.12.3-linux-x86_64-gnu /usr/bin/python3 cpython-3.12.3-linux-x86_64-gnu /bin/python3 cpython-3.12.3-linux-x86_64-gnu <download available> cpython-3.12.3-linux-s390x-gnu <download available> cpython-3.12.3-linux-powerpc64le-gnu <download available> cpython-3.12.3-linux-armv7-gnueabihf <download available> cpython-3.12.3-linux-armv7-gnueabi <download available> cpython-3.12.3-linux-aarch64-gnu <download available> ... ``` ## Test Plan The following commands were executed on the command line to confirm the results in Ubuntu 24.04. - `cargo run python list` - `cargo run python list --all-platforms`
This commit is contained in:
parent
afe35e787d
commit
720ae195a1
2 changed files with 8 additions and 2 deletions
|
@ -233,6 +233,11 @@ impl PythonDownloadRequest {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(libc) = &self.libc {
|
||||||
|
if key.libc != *libc {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(implementation) = &self.implementation {
|
if let Some(implementation) = &self.implementation {
|
||||||
if key.implementation != LenientImplementationName::from(*implementation) {
|
if key.implementation != LenientImplementationName::from(*implementation) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -113,14 +113,15 @@ pub(crate) async fn list(
|
||||||
// Only show the latest patch version for each download unless all were requested
|
// Only show the latest patch version for each download unless all were requested
|
||||||
if !matches!(kind, Kind::System) {
|
if !matches!(kind, Kind::System) {
|
||||||
if let [major, minor, ..] = version.release() {
|
if let [major, minor, ..] = version.release() {
|
||||||
if !seen_minor.insert((os.clone(), *major, *minor)) {
|
if !seen_minor.insert((os.clone(), *major, *minor, *key.arch(), *key.libc())) {
|
||||||
if matches!(kind, Kind::Download) && !all_versions {
|
if matches!(kind, Kind::Download) && !all_versions {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let [major, minor, patch] = version.release() {
|
if let [major, minor, patch] = version.release() {
|
||||||
if !seen_patch.insert((os.clone(), *major, *minor, *patch)) {
|
if !seen_patch.insert((os.clone(), *major, *minor, *patch, *key.arch(), key.libc()))
|
||||||
|
{
|
||||||
if matches!(kind, Kind::Download) {
|
if matches!(kind, Kind::Download) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue