mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-01 17:42:19 +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 = std::str::from_utf8(yanked.as_bytes())?;
|
||||
let yanked = html_escape::decode_html_entities(yanked);
|
||||
Some(Yanked::Reason(yanked.into()))
|
||||
Some(Box::new(Yanked::Reason(yanked.into())))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ pub struct File {
|
|||
// milliseconds.
|
||||
pub upload_time_utc_ms: Option<i64>,
|
||||
pub url: FileLocation,
|
||||
pub yanked: Option<Yanked>,
|
||||
pub yanked: Option<Box<Yanked>>,
|
||||
}
|
||||
|
||||
impl File {
|
||||
|
|
|
@ -75,8 +75,10 @@ impl ResolvedDist {
|
|||
pub fn yanked(&self) -> Option<&Yanked> {
|
||||
match self {
|
||||
Self::Installable { dist, .. } => match dist.as_ref() {
|
||||
Dist::Source(SourceDist::Registry(sdist)) => sdist.file.yanked.as_ref(),
|
||||
Dist::Built(BuiltDist::Registry(wheel)) => wheel.best_wheel().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_deref()
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
Self::Installed { .. } => None,
|
||||
|
|
|
@ -54,7 +54,7 @@ pub struct File {
|
|||
pub size: Option<u64>,
|
||||
pub upload_time: Option<Timestamp>,
|
||||
pub url: String,
|
||||
pub yanked: Option<Yanked>,
|
||||
pub yanked: Option<Box<Yanked>>,
|
||||
}
|
||||
|
||||
fn deserialize_version_specifiers_lenient<'de, D>(
|
||||
|
|
|
@ -417,7 +417,7 @@ impl VersionMapLazy {
|
|||
};
|
||||
|
||||
// Prioritize amongst all available files.
|
||||
let yanked = file.yanked.clone();
|
||||
let yanked = file.yanked.as_deref();
|
||||
let hashes = file.hashes.clone();
|
||||
match filename {
|
||||
DistFilename::WheelFilename(filename) => {
|
||||
|
@ -472,7 +472,7 @@ impl VersionMapLazy {
|
|||
name: &PackageName,
|
||||
version: &Version,
|
||||
hashes: &[HashDigest],
|
||||
yanked: Option<Yanked>,
|
||||
yanked: Option<&Yanked>,
|
||||
excluded: bool,
|
||||
upload_time: Option<i64>,
|
||||
) -> SourceDistCompatibility {
|
||||
|
@ -491,7 +491,9 @@ impl VersionMapLazy {
|
|||
// Check if yanked
|
||||
if let Some(yanked) = yanked {
|
||||
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,
|
||||
version: &Version,
|
||||
hashes: &[HashDigest],
|
||||
yanked: Option<Yanked>,
|
||||
yanked: Option<&Yanked>,
|
||||
excluded: bool,
|
||||
upload_time: Option<i64>,
|
||||
) -> WheelCompatibility {
|
||||
|
@ -536,7 +538,7 @@ impl VersionMapLazy {
|
|||
// Check if yanked
|
||||
if let Some(yanked) = yanked {
|
||||
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