Filter out files with invalid requires python specifiers (#775)

Instead of trying to fixup _all_ the invalid version specifiers on pypi
and elsewhere, this filters out distributions with invalid
`requires-python` version specifiers that even
`LenientVersionSpecifiers` couldn't parse, as opposed to failing
entirely, which we currently do.

I would be nicer to model through an invalid distribution pubgrub type,
together with e.g. source dists with an unknown extension, so that the
version itself still shows up in the error trace.

At the same time, we reduce the log level for fixups from warning to
trace, as they are not actionable for the user.
This commit is contained in:
konsti 2024-01-09 03:46:27 +01:00 committed by GitHub
parent 64da1f0306
commit b1edecdf1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 23 deletions

View file

@ -256,7 +256,7 @@ impl<'a> Candidate<'a> {
self.file.install()
}
/// If the candidate doesn't the given requirement, return the version specifiers.
/// If the candidate doesn't match the given requirement, return the version specifiers.
pub(crate) fn validate(&self, requirement: &PythonRequirement) -> Option<&VersionSpecifiers> {
// Validate against the _installed_ file. It's fine if the _resolved_ file is incompatible,
// since it could be an incompatible wheel. (If the resolved file is an incompatible source