mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +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
|
@ -27,6 +27,7 @@ uv-configuration = { workspace = true }
|
|||
uv-distribution = { workspace = true }
|
||||
uv-extract = { workspace = true }
|
||||
uv-fs = { workspace = true }
|
||||
uv-git = { workspace = true }
|
||||
uv-interpreter = { workspace = true }
|
||||
uv-normalize = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
|
|
|
@ -21,6 +21,7 @@ use uv_distribution::{
|
|||
BuiltWheelIndex, HttpArchivePointer, LocalArchivePointer, RegistryWheelIndex,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
use uv_git::GitUrl;
|
||||
use uv_interpreter::PythonEnvironment;
|
||||
use uv_types::HashStrategy;
|
||||
|
||||
|
@ -224,7 +225,11 @@ impl<'a> Planner<'a> {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
RequirementSource::Url { url, .. } => {
|
||||
RequirementSource::Url {
|
||||
subdirectory,
|
||||
location,
|
||||
url,
|
||||
} => {
|
||||
// Check if we have a wheel or a source distribution.
|
||||
if Path::new(url.path())
|
||||
.extension()
|
||||
|
@ -243,6 +248,8 @@ impl<'a> Planner<'a> {
|
|||
|
||||
let wheel = DirectUrlBuiltDist {
|
||||
filename,
|
||||
location: location.clone(),
|
||||
subdirectory: subdirectory.clone(),
|
||||
url: url.clone(),
|
||||
};
|
||||
|
||||
|
@ -288,6 +295,8 @@ impl<'a> Planner<'a> {
|
|||
} else {
|
||||
let sdist = DirectUrlSourceDist {
|
||||
name: requirement.name.clone(),
|
||||
location: location.clone(),
|
||||
subdirectory: subdirectory.clone(),
|
||||
url: url.clone(),
|
||||
};
|
||||
// Find the most-compatible wheel from the cache, since we don't know
|
||||
|
@ -300,9 +309,16 @@ impl<'a> Planner<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
RequirementSource::Git { url, .. } => {
|
||||
RequirementSource::Git {
|
||||
repository,
|
||||
reference,
|
||||
subdirectory,
|
||||
url,
|
||||
} => {
|
||||
let sdist = GitSourceDist {
|
||||
name: requirement.name.clone(),
|
||||
git: Box::new(GitUrl::new(repository.clone(), reference.clone())),
|
||||
subdirectory: subdirectory.clone(),
|
||||
url: url.clone(),
|
||||
};
|
||||
// Find the most-compatible wheel from the cache, since we don't know
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue