mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-02 10:02:16 +00:00
Use a Box
for Yanked
on File
(#11755)
## Summary See: https://github.com/astral-sh/uv/pull/11715.
This commit is contained in:
parent
a6ecf463fc
commit
d9adba1cf5
5 changed files with 14 additions and 10 deletions
|
@ -184,7 +184,7 @@ impl SimpleHtml {
|
||||||
let yanked = if let Some(yanked) = link.attributes().get("data-yanked").flatten() {
|
let yanked = if let Some(yanked) = link.attributes().get("data-yanked").flatten() {
|
||||||
let yanked = std::str::from_utf8(yanked.as_bytes())?;
|
let yanked = std::str::from_utf8(yanked.as_bytes())?;
|
||||||
let yanked = html_escape::decode_html_entities(yanked);
|
let yanked = html_escape::decode_html_entities(yanked);
|
||||||
Some(Yanked::Reason(yanked.into()))
|
Some(Box::new(Yanked::Reason(yanked.into())))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub struct File {
|
||||||
// milliseconds.
|
// milliseconds.
|
||||||
pub upload_time_utc_ms: Option<i64>,
|
pub upload_time_utc_ms: Option<i64>,
|
||||||
pub url: FileLocation,
|
pub url: FileLocation,
|
||||||
pub yanked: Option<Yanked>,
|
pub yanked: Option<Box<Yanked>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
|
|
|
@ -75,8 +75,10 @@ impl ResolvedDist {
|
||||||
pub fn yanked(&self) -> Option<&Yanked> {
|
pub fn yanked(&self) -> Option<&Yanked> {
|
||||||
match self {
|
match self {
|
||||||
Self::Installable { dist, .. } => match dist.as_ref() {
|
Self::Installable { dist, .. } => match dist.as_ref() {
|
||||||
Dist::Source(SourceDist::Registry(sdist)) => sdist.file.yanked.as_ref(),
|
Dist::Source(SourceDist::Registry(sdist)) => sdist.file.yanked.as_deref(),
|
||||||
Dist::Built(BuiltDist::Registry(wheel)) => wheel.best_wheel().file.yanked.as_ref(),
|
Dist::Built(BuiltDist::Registry(wheel)) => {
|
||||||
|
wheel.best_wheel().file.yanked.as_deref()
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
Self::Installed { .. } => None,
|
Self::Installed { .. } => None,
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub struct File {
|
||||||
pub size: Option<u64>,
|
pub size: Option<u64>,
|
||||||
pub upload_time: Option<Timestamp>,
|
pub upload_time: Option<Timestamp>,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub yanked: Option<Yanked>,
|
pub yanked: Option<Box<Yanked>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_version_specifiers_lenient<'de, D>(
|
fn deserialize_version_specifiers_lenient<'de, D>(
|
||||||
|
|
|
@ -417,7 +417,7 @@ impl VersionMapLazy {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Prioritize amongst all available files.
|
// Prioritize amongst all available files.
|
||||||
let yanked = file.yanked.clone();
|
let yanked = file.yanked.as_deref();
|
||||||
let hashes = file.hashes.clone();
|
let hashes = file.hashes.clone();
|
||||||
match filename {
|
match filename {
|
||||||
DistFilename::WheelFilename(filename) => {
|
DistFilename::WheelFilename(filename) => {
|
||||||
|
@ -472,7 +472,7 @@ impl VersionMapLazy {
|
||||||
name: &PackageName,
|
name: &PackageName,
|
||||||
version: &Version,
|
version: &Version,
|
||||||
hashes: &[HashDigest],
|
hashes: &[HashDigest],
|
||||||
yanked: Option<Yanked>,
|
yanked: Option<&Yanked>,
|
||||||
excluded: bool,
|
excluded: bool,
|
||||||
upload_time: Option<i64>,
|
upload_time: Option<i64>,
|
||||||
) -> SourceDistCompatibility {
|
) -> SourceDistCompatibility {
|
||||||
|
@ -491,7 +491,9 @@ impl VersionMapLazy {
|
||||||
// Check if yanked
|
// Check if yanked
|
||||||
if let Some(yanked) = yanked {
|
if let Some(yanked) = yanked {
|
||||||
if yanked.is_yanked() && !self.allowed_yanks.contains(name, version) {
|
if yanked.is_yanked() && !self.allowed_yanks.contains(name, version) {
|
||||||
return SourceDistCompatibility::Incompatible(IncompatibleSource::Yanked(yanked));
|
return SourceDistCompatibility::Incompatible(IncompatibleSource::Yanked(
|
||||||
|
yanked.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +521,7 @@ impl VersionMapLazy {
|
||||||
name: &PackageName,
|
name: &PackageName,
|
||||||
version: &Version,
|
version: &Version,
|
||||||
hashes: &[HashDigest],
|
hashes: &[HashDigest],
|
||||||
yanked: Option<Yanked>,
|
yanked: Option<&Yanked>,
|
||||||
excluded: bool,
|
excluded: bool,
|
||||||
upload_time: Option<i64>,
|
upload_time: Option<i64>,
|
||||||
) -> WheelCompatibility {
|
) -> WheelCompatibility {
|
||||||
|
@ -536,7 +538,7 @@ impl VersionMapLazy {
|
||||||
// Check if yanked
|
// Check if yanked
|
||||||
if let Some(yanked) = yanked {
|
if let Some(yanked) = yanked {
|
||||||
if yanked.is_yanked() && !self.allowed_yanks.contains(name, version) {
|
if yanked.is_yanked() && !self.allowed_yanks.contains(name, version) {
|
||||||
return WheelCompatibility::Incompatible(IncompatibleWheel::Yanked(yanked));
|
return WheelCompatibility::Incompatible(IncompatibleWheel::Yanked(yanked.clone()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue