mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-22 00:02:32 +00:00
Remove URL clone in requirements-txt parser (#1020)
This commit is contained in:
parent
b3954f2449
commit
69d2791a43
2 changed files with 14 additions and 5 deletions
|
@ -37,7 +37,7 @@ impl VerbatimUrl {
|
|||
}
|
||||
|
||||
/// Parse a URL from a path.
|
||||
pub fn from_path(path: impl AsRef<str>, working_dir: impl AsRef<Path>, given: String) -> Self {
|
||||
pub fn from_path(path: impl AsRef<str>, working_dir: impl AsRef<Path>) -> Self {
|
||||
// Expand any environment variables.
|
||||
let path = PathBuf::from(expand_env_vars(path.as_ref(), false).as_ref());
|
||||
|
||||
|
@ -54,9 +54,15 @@ impl VerbatimUrl {
|
|||
// Convert to a URL.
|
||||
let url = Url::from_file_path(path).expect("path is absolute");
|
||||
|
||||
Self { url, given: None }
|
||||
}
|
||||
|
||||
/// Set the verbatim representation of the URL.
|
||||
#[must_use]
|
||||
pub fn with_given(self, given: String) -> Self {
|
||||
Self {
|
||||
url,
|
||||
given: Some(given),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue