Improve PEP 691 compatibility (#428)

[PEP 691](https://peps.python.org/pep-0691/#project-detail) has slightly
different, more relaxed rules around file metadata. These changes are
now reflected in the `File` struct. This will make it easier to support
alternative indices.

I had expected that i need to introduce a separate type for that, so i'm
happy it's two `Option`s more and an alias.

Part of #412
This commit is contained in:
konsti 2023-11-16 19:03:44 +01:00 committed by GitHub
parent 3a4988f999
commit 751f7fa9c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 27 deletions

View file

@ -6,7 +6,7 @@ use distribution_filename::{SourceDistFilename, WheelFilename};
use pep440_rs::Version;
use platform_tags::{TagPriority, Tags};
use puffin_normalize::PackageName;
use pypi_types::SimpleJson;
use pypi_types::{SimpleJson, Yanked};
use crate::file::{DistFile, SdistFile, WheelFile};
use crate::pubgrub::PubGrubVersion;
@ -45,7 +45,7 @@ impl VersionMap {
// When resolving, exclude yanked files.
// TODO(konstin): When we fail resolving due to a dependency locked to yanked version,
// we should tell the user.
if file.yanked.is_yanked() {
if file.yanked.as_ref().is_some_and(Yanked::is_yanked) {
continue;
}