Skip to content

Commit

Permalink
Ignore libc on other platforms (astral-sh#3825)
Browse files Browse the repository at this point in the history
Libc variants are only relevant on linux, we can ignore it on non
{linux, windows, mac}, e.g. BSDs.

Closes astral-sh#3824
  • Loading branch information
konstin authored May 25, 2024
1 parent c2931e8 commit f4533c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/uv-interpreter/src/managed/downloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl PythonDownloadRequest {
self.os = Some(Os::from_env()?);
}
if self.libc.is_none() {
self.libc = Some(Libc::from_env()?);
self.libc = Some(Libc::from_env());
}
Ok(self)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-interpreter/src/managed/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ pub fn toolchains_for_version(version: &PythonVersion) -> Result<Vec<Toolchain>,
fn platform_key_from_env() -> Result<String, Error> {
let os = Os::from_env()?;
let arch = Arch::from_env()?;
let libc = Libc::from_env()?;
let libc = Libc::from_env();
Ok(format!("{os}-{arch}-{libc}").to_lowercase())
}
12 changes: 7 additions & 5 deletions crates/uv-interpreter/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Platform {
Ok(Self::new(
Os::from_env()?,
Arch::from_env()?,
Libc::from_env()?,
Libc::from_env(),
))
}
}
Expand Down Expand Up @@ -149,12 +149,14 @@ impl Arch {
}

impl Libc {
pub(crate) fn from_env() -> Result<Self, Error> {
pub(crate) fn from_env() -> Self {
// TODO(zanieb): Perform this lookup
match std::env::consts::OS {
"linux" => Ok(Libc::Gnu),
"windows" | "macos" => Ok(Libc::None),
_ => Err(Error::LibcNotDetected()),
// Supported platforms.
"linux" => Libc::Gnu,
"windows" | "macos" => Libc::None,
// Platforms without explicit support.
_ => Libc::None,
}
}
}
Expand Down

0 comments on commit f4533c3

Please sign in to comment.