mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 03:02:55 +00:00
Refactor incompatiblity tracking for distributions (#1298)
Extends the "compatibility" types introduced in #1293 to apply to source distributions as well as wheels. - We now track the most-relevant incompatible source distribution - Exclude newer, Python requirements, and yanked versions are all tracked as incompatibilities in the new model (this lets us remove `DistMetadata`!)
This commit is contained in:
parent
1181aa9be4
commit
10c4effbd3
16 changed files with 498 additions and 343 deletions
|
|
@ -8,8 +8,8 @@ use crate::Manifest;
|
|||
|
||||
/// A set of package versions that are permitted, even if they're marked as yanked by the
|
||||
/// relevant index.
|
||||
#[derive(Debug, Default)]
|
||||
pub(crate) struct AllowedYanks(FxHashMap<PackageName, FxHashSet<Version>>);
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct AllowedYanks(FxHashMap<PackageName, FxHashSet<Version>>);
|
||||
|
||||
impl AllowedYanks {
|
||||
pub(crate) fn from_manifest(manifest: &Manifest, markers: &MarkerEnvironment) -> Self {
|
||||
|
|
@ -49,11 +49,12 @@ impl AllowedYanks {
|
|||
Self(allowed_yanks)
|
||||
}
|
||||
|
||||
/// Returns `true` if the given package version is allowed, even if it's marked as yanked by
|
||||
/// the relevant index.
|
||||
pub(crate) fn allowed(&self, package_name: &PackageName, version: &Version) -> bool {
|
||||
self.0
|
||||
.get(package_name)
|
||||
.is_some_and(|allowed_yanks| allowed_yanks.contains(version))
|
||||
/// Returns versions for the given package which are allowed even if marked as yanked by the
|
||||
/// relevant index.
|
||||
pub(crate) fn allowed_versions(
|
||||
&self,
|
||||
package_name: &PackageName,
|
||||
) -> Option<&FxHashSet<Version>> {
|
||||
self.0.get(package_name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue