mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Wheel filename distribution package name (#278)
The normalized name abstractions were not consistently, this PR uses them where they were previously missing: * `WheelFilename::distribution` * `Requirement::name` * `Requirement::extras` * `Metadata21::name` * `Metadata21::provides_dist` With `puffin-package` depending on `pep508_rs` this would be cyclical crate dependency, so `puffin-normalize` gets split out from `puffin-package`. `DistInfoName` has the same task and semantics as `PackageName`, so it's merged into the latter. `PackageName` and `ExtraName` documentation is moved onto the type and their constructors are called `new` instead of `normalize`. We now use these constructors rarely enough the implicit allocation by `to_string()` shouldn't matter anymore, while more actual cloning becomes visible.
This commit is contained in:
parent
8a8b532330
commit
4adaa9a700
61 changed files with 483 additions and 416 deletions
|
@ -899,7 +899,7 @@ pub fn install_wheel(
|
|||
sys_executable: impl AsRef<Path>,
|
||||
) -> Result<String, Error> {
|
||||
let name = &filename.distribution;
|
||||
let _my_span = span!(Level::DEBUG, "install_wheel", name = name.as_str());
|
||||
let _my_span = span!(Level::DEBUG, "install_wheel", name = name.as_ref());
|
||||
|
||||
let base_location = location.venv_root();
|
||||
|
||||
|
@ -918,12 +918,12 @@ pub fn install_wheel(
|
|||
.join("site-packages")
|
||||
};
|
||||
|
||||
debug!(name = name.as_str(), "Opening zip");
|
||||
debug!(name = name.as_ref(), "Opening zip");
|
||||
// No BufReader: https://github.com/zip-rs/zip/issues/381
|
||||
let mut archive =
|
||||
ZipArchive::new(reader).map_err(|err| Error::from_zip_error("(index)".to_string(), err))?;
|
||||
|
||||
debug!(name = name.as_str(), "Getting wheel metadata");
|
||||
debug!(name = name.as_ref(), "Getting wheel metadata");
|
||||
let dist_info_prefix = find_dist_info(filename, &mut archive)?;
|
||||
let (name, _version) = read_metadata(&dist_info_prefix, &mut archive)?;
|
||||
// TODO: Check that name and version match
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue