mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add parsed URL fields to Dist
variants (#3429)
Avoid reparsing urls by storing the parsed parts across resolution on `Dist`. Part 2 of https://github.com/astral-sh/uv/issues/3408 and part of #3409 Closes #3408
This commit is contained in:
parent
0010954ca7
commit
c22c7cad4c
8 changed files with 107 additions and 83 deletions
|
@ -1,11 +1,11 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use anstream::println;
|
||||
use anyhow::Result;
|
||||
use anyhow::{bail, Result};
|
||||
use clap::Parser;
|
||||
|
||||
use distribution_filename::WheelFilename;
|
||||
use distribution_types::{BuiltDist, DirectUrlBuiltDist};
|
||||
use distribution_types::{BuiltDist, DirectUrlBuiltDist, ParsedUrl};
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use uv_cache::{Cache, CacheArgs};
|
||||
use uv_client::RegistryClientBuilder;
|
||||
|
@ -30,9 +30,15 @@ pub(crate) async fn wheel_metadata(args: WheelMetadataArgs) -> Result<()> {
|
|||
.1,
|
||||
)?;
|
||||
|
||||
let ParsedUrl::Archive(archive) = ParsedUrl::try_from(args.url.to_url())? else {
|
||||
bail!("Only HTTPS is supported");
|
||||
};
|
||||
|
||||
let metadata = client
|
||||
.wheel_metadata(&BuiltDist::DirectUrl(DirectUrlBuiltDist {
|
||||
filename,
|
||||
location: archive.url,
|
||||
subdirectory: archive.subdirectory,
|
||||
url: args.url,
|
||||
}))
|
||||
.await?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue