Skip to content

Commit

Permalink
fix: issue 529 (#535)
Browse files Browse the repository at this point in the history
Fix #529
  • Loading branch information
baszalmstra authored Dec 4, 2023
1 parent 7774cc2 commit f2df5c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lock_file/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,16 @@ fn project_platforms(platform: Platform, system_requirements: &SystemRequirement
_ => unreachable!("not windows"),
}
} else if platform.is_linux() {
let max_glibc_version = match &system_requirements.libc {
Some(LibCSystemRequirement::GlibC(v)) => v.clone(),
Some(LibCSystemRequirement::OtherFamily(_)) => return Vec::new(),
let max_glibc_version = match system_requirements
.libc
.as_ref()
.map(LibCSystemRequirement::family_and_version)
{
Some((family, version)) if family.eq_ignore_ascii_case("glibc") => version.clone(),
Some(_) => {
// Another libc family is being target.
return Vec::new();
}
None => default_glibc_version(),
};
linux_platform_tags(platform, &max_glibc_version)
Expand Down
12 changes: 12 additions & 0 deletions src/project/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ pub enum LibCSystemRequirement {
OtherFamily(LibCFamilyAndVersion),
}

impl LibCSystemRequirement {
/// Returns the family and version of this libc requirement.
pub fn family_and_version(&self) -> (&str, &Version) {
match self {
LibCSystemRequirement::GlibC(version) => ("glibc", version),
LibCSystemRequirement::OtherFamily(LibCFamilyAndVersion { family, version: v }) => {
(family.as_deref().unwrap_or("glibc"), v)
}
}
}
}

#[serde_as]
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
Expand Down

0 comments on commit f2df5c8

Please sign in to comment.