mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-23 00:32:13 +00:00
Fix pep508-rs tests without features (#1778)
This commit is contained in:
parent
2928c6e574
commit
8df48f035f
1 changed files with 19 additions and 19 deletions
|
@ -743,7 +743,7 @@ fn preprocess_url(
|
||||||
start: usize,
|
start: usize,
|
||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<VerbatimUrl, Pep508Error> {
|
) -> Result<VerbatimUrl, Pep508Error> {
|
||||||
let url = if let Some((scheme, path)) = split_scheme(url) {
|
if let Some((scheme, path)) = split_scheme(url) {
|
||||||
match Scheme::parse(scheme) {
|
match Scheme::parse(scheme) {
|
||||||
// Ex) `file:///home/ferris/project/scripts/...` or `file:../editable/`.
|
// Ex) `file:///home/ferris/project/scripts/...` or `file:../editable/`.
|
||||||
Some(Scheme::File) => {
|
Some(Scheme::File) => {
|
||||||
|
@ -759,40 +759,41 @@ fn preprocess_url(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
VerbatimUrl::from_absolute_path(path)
|
Ok(VerbatimUrl::from_absolute_path(path)
|
||||||
.map_err(|err| Pep508Error {
|
.map_err(|err| Pep508Error {
|
||||||
message: Pep508ErrorSource::UrlError(err),
|
message: Pep508ErrorSource::UrlError(err),
|
||||||
start,
|
start,
|
||||||
len,
|
len,
|
||||||
input: cursor.to_string(),
|
input: cursor.to_string(),
|
||||||
})?
|
})?
|
||||||
.with_given(url.to_string())
|
.with_given(url.to_string()))
|
||||||
}
|
}
|
||||||
// Ex) `https://download.pytorch.org/whl/torch_stable.html`
|
// Ex) `https://download.pytorch.org/whl/torch_stable.html`
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
// Ex) `https://download.pytorch.org/whl/torch_stable.html`
|
// Ex) `https://download.pytorch.org/whl/torch_stable.html`
|
||||||
VerbatimUrl::from_str(url).map_err(|err| Pep508Error {
|
Ok(VerbatimUrl::from_str(url).map_err(|err| Pep508Error {
|
||||||
message: Pep508ErrorSource::UrlError(err),
|
message: Pep508ErrorSource::UrlError(err),
|
||||||
start,
|
start,
|
||||||
len,
|
len,
|
||||||
input: cursor.to_string(),
|
input: cursor.to_string(),
|
||||||
})?
|
})?)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ex) `C:\Users\ferris\wheel-0.42.0.tar.gz`
|
// Ex) `C:\Users\ferris\wheel-0.42.0.tar.gz`
|
||||||
_ => {
|
_ => {
|
||||||
|
#[cfg(feature = "non-pep508-extensions")]
|
||||||
if let Some(working_dir) = working_dir {
|
if let Some(working_dir) = working_dir {
|
||||||
VerbatimUrl::from_path(url, working_dir).with_given(url.to_string())
|
return Ok(VerbatimUrl::from_path(url, working_dir).with_given(url.to_string()));
|
||||||
} else {
|
}
|
||||||
VerbatimUrl::from_absolute_path(url)
|
|
||||||
|
Ok(VerbatimUrl::from_absolute_path(url)
|
||||||
.map_err(|err| Pep508Error {
|
.map_err(|err| Pep508Error {
|
||||||
message: Pep508ErrorSource::UrlError(err),
|
message: Pep508ErrorSource::UrlError(err),
|
||||||
start,
|
start,
|
||||||
len,
|
len,
|
||||||
input: cursor.to_string(),
|
input: cursor.to_string(),
|
||||||
})?
|
})?
|
||||||
.with_given(url.to_string())
|
.with_given(url.to_string()))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -802,16 +803,15 @@ fn preprocess_url(
|
||||||
return Ok(VerbatimUrl::from_path(url, working_dir).with_given(url.to_string()));
|
return Ok(VerbatimUrl::from_path(url, working_dir).with_given(url.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
VerbatimUrl::from_absolute_path(url)
|
Ok(VerbatimUrl::from_absolute_path(url)
|
||||||
.map_err(|err| Pep508Error {
|
.map_err(|err| Pep508Error {
|
||||||
message: Pep508ErrorSource::UrlError(err),
|
message: Pep508ErrorSource::UrlError(err),
|
||||||
start,
|
start,
|
||||||
len,
|
len,
|
||||||
input: cursor.to_string(),
|
input: cursor.to_string(),
|
||||||
})?
|
})?
|
||||||
.with_given(url.to_string())
|
.with_given(url.to_string()))
|
||||||
};
|
}
|
||||||
Ok(url)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// PEP 440 wrapper
|
/// PEP 440 wrapper
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue