Add source distribution filename abstraction (#154)

The need for this became clear when working on the source distribution
integration into the resolver.

While at it i also switch the `WheelFilename` version to the parsed
`pep440_rs` version now that we have this crate.
This commit is contained in:
konsti 2023-10-20 17:45:57 +02:00 committed by GitHub
parent 6f52b5ca4d
commit ae9d1f7572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 220 additions and 58 deletions

View file

@ -18,7 +18,7 @@ name = "install_wheel_rs"
[dependencies]
platform-host = { path = "../platform-host" }
wheel-filename = { path = "../wheel-filename" }
distribution-filename = { path = "../distribution-filename" }
clap = { workspace = true, optional = true, features = ["derive", "env"] }
configparser = { workspace = true }

View file

@ -42,7 +42,7 @@ pub enum Error {
InvalidPoetry(String),
/// Doesn't follow file name schema
#[error(transparent)]
InvalidWheelFileName(#[from] wheel_filename::Error),
InvalidWheelFileName(#[from] distribution_filename::WheelFilenameError),
#[error("Failed to read the wheel file {0}")]
Zip(String, #[source] ZipError),
#[error("Failed to run python subcommand")]

View file

@ -6,8 +6,8 @@ use fs_err::File;
#[cfg(feature = "rayon")]
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use distribution_filename::WheelFilename;
use install_wheel_rs::{install_wheel, Error, InstallLocation};
use wheel_filename::WheelFilename;
/// Low level install CLI, mainly used for testing
#[derive(Parser)]

View file

@ -1,6 +1,7 @@
#![allow(clippy::format_push_string)] // I will not replace clear and infallible with fallible, io looking code
use crate::{install_wheel, Error, InstallLocation, LockedDir};
use distribution_filename::WheelFilename;
use fs_err::File;
use pyo3::create_exception;
use pyo3::types::PyModule;
@ -8,7 +9,6 @@ use pyo3::{pyclass, pymethods, pymodule, PyErr, PyResult, Python};
use std::env;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use wheel_filename::WheelFilename;
create_exception!(
install_wheel_rs,

View file

@ -19,7 +19,7 @@ use zip::result::ZipError;
use zip::write::FileOptions;
use zip::{ZipArchive, ZipWriter};
use wheel_filename::WheelFilename;
use distribution_filename::WheelFilename;
use crate::install_location::{InstallLocation, LockedDir};
use crate::record::RecordEntry;