mirror of https://github.com/astral-sh/uv
Include build tag in rendered wheel filenames (#10599)
## Summary I don't think this had an impact in practice, but it is "wrong" to omit these. Confirmed that the cache (for example) now includes the build tag (as in, `mkl_fft-1.3.8-72-cp310-cp310-manylinux2014_x86_64`).
This commit is contained in:
parent
4b658c4ede
commit
279043f864
|
|
@ -5010,6 +5010,7 @@ dependencies = [
|
||||||
"uv-normalize",
|
"uv-normalize",
|
||||||
"uv-pep440",
|
"uv-pep440",
|
||||||
"uv-platform-tags",
|
"uv-platform-tags",
|
||||||
|
"uv-small-str",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ workspace = true
|
||||||
uv-normalize = { workspace = true }
|
uv-normalize = { workspace = true }
|
||||||
uv-pep440 = { workspace = true }
|
uv-pep440 = { workspace = true }
|
||||||
uv-platform-tags = { workspace = true }
|
uv-platform-tags = { workspace = true }
|
||||||
|
uv-small-str = { workspace = true }
|
||||||
|
|
||||||
rkyv = { workspace = true, features = ["smallvec-1"] }
|
rkyv = { workspace = true, features = ["smallvec-1"] }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
|
||||||
|
use uv_small_str::SmallString;
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum BuildTagError {
|
pub enum BuildTagError {
|
||||||
|
|
@ -33,7 +34,7 @@ pub enum BuildTagError {
|
||||||
rkyv::Serialize,
|
rkyv::Serialize,
|
||||||
)]
|
)]
|
||||||
#[rkyv(derive(Debug))]
|
#[rkyv(derive(Debug))]
|
||||||
pub struct BuildTag(u64, Option<Arc<str>>);
|
pub struct BuildTag(u64, Option<SmallString>);
|
||||||
|
|
||||||
impl FromStr for BuildTag {
|
impl FromStr for BuildTag {
|
||||||
type Err = BuildTagError;
|
type Err = BuildTagError;
|
||||||
|
|
@ -57,6 +58,18 @@ impl FromStr for BuildTag {
|
||||||
None => (s, None),
|
None => (s, None),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(BuildTag(prefix.parse::<u64>()?, suffix.map(Arc::from)))
|
Ok(BuildTag(
|
||||||
|
prefix.parse::<u64>()?,
|
||||||
|
suffix.map(SmallString::from),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for BuildTag {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match &self.1 {
|
||||||
|
Some(suffix) => write!(f, "{}{}", self.0, suffix),
|
||||||
|
None => write!(f, "{}", self.0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -407,6 +407,9 @@ pub struct WheelTagLarge {
|
||||||
|
|
||||||
impl Display for WheelTagLarge {
|
impl Display for WheelTagLarge {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
if let Some(build_tag) = &self.build_tag {
|
||||||
|
write!(f, "{build_tag}-")?;
|
||||||
|
}
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{}-{}-{}",
|
"{}-{}-{}",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue