mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-28 18:54:10 +00:00
Add support for local directories with --index-url (#4226)
## Summary Closes #4078.
This commit is contained in:
parent
f296ef08d6
commit
656fc427b9
10 changed files with 219 additions and 31 deletions
|
|
@ -124,6 +124,26 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
}
|
||||
};
|
||||
|
||||
// If the URL is a file URL, use the local path directly.
|
||||
if url.scheme() == "file" {
|
||||
let path = url
|
||||
.to_file_path()
|
||||
.map_err(|()| Error::NonFileUrl(url.clone()))?;
|
||||
return self
|
||||
.archive(
|
||||
source,
|
||||
&PathSourceUrl {
|
||||
url: &url,
|
||||
path: Cow::Owned(path),
|
||||
},
|
||||
&cache_shard,
|
||||
tags,
|
||||
hashes,
|
||||
)
|
||||
.boxed_local()
|
||||
.await;
|
||||
}
|
||||
|
||||
self.url(
|
||||
source,
|
||||
&dist.file.filename,
|
||||
|
|
@ -281,6 +301,25 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
}
|
||||
};
|
||||
|
||||
// If the URL is a file URL, use the local path directly.
|
||||
if url.scheme() == "file" {
|
||||
let path = url
|
||||
.to_file_path()
|
||||
.map_err(|()| Error::NonFileUrl(url.clone()))?;
|
||||
return self
|
||||
.archive_metadata(
|
||||
source,
|
||||
&PathSourceUrl {
|
||||
url: &url,
|
||||
path: Cow::Owned(path),
|
||||
},
|
||||
&cache_shard,
|
||||
hashes,
|
||||
)
|
||||
.boxed_local()
|
||||
.await;
|
||||
}
|
||||
|
||||
self.url_metadata(
|
||||
source,
|
||||
&dist.file.filename,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue