Refactor distribution types to return Result (#470)

## Summary

A variety of small refactors to the distribution types crate to (1)
return `Result` if we find an invalid wheel, rather than treating it as
a source distribution with a `.whl` suffix, and (2) DRY up some repeated
code around URLs.
This commit is contained in:
Charlie Marsh 2023-11-20 23:08:54 +00:00 committed by GitHub
parent f0841cdb6e
commit f1aa70d9d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 119 additions and 97 deletions

View file

@ -50,6 +50,9 @@ pub enum ResolveError {
#[error("Package `{0}` attempted to resolve via URL: {1}. URL dependencies must be expressed as direct requirements or constraints. Consider adding `{0} @ {1}` to your dependencies or constraints file.")]
DisallowedUrl(PackageName, Url),
#[error(transparent)]
DistributionType(#[from] distribution_types::Error),
#[error("Failed to fetch wheel metadata from: {filename}")]
RegistryBuiltDist {
filename: String,