mirror of https://github.com/astral-sh/uv
Omit `--find-links` from annotation header unless requested (#1898)
## Summary Like #1835, but for `--find-links` (for consistency).
This commit is contained in:
parent
3bd4ccad11
commit
73ed0f0cf1
|
|
@ -346,7 +346,7 @@ pub(crate) async fn pip_compile(
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
"{}",
|
"{}",
|
||||||
format!("# {}", cmd(include_index_url)).green()
|
format!("# {}", cmd(include_index_url, include_find_links)).green()
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,29 +393,49 @@ pub(crate) async fn pip_compile(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format the `uv` command used to generate the output file.
|
/// Format the `uv` command used to generate the output file.
|
||||||
fn cmd(include_index_url: bool) -> String {
|
fn cmd(include_index_url: bool, include_find_links: bool) -> String {
|
||||||
let args = env::args_os()
|
let args = env::args_os()
|
||||||
.skip(1)
|
.skip(1)
|
||||||
.map(|arg| arg.normalized_display().to_string())
|
.map(|arg| arg.normalized_display().to_string())
|
||||||
.scan(None, move |skip_next, arg| {
|
.scan(None, move |skip_next, arg| {
|
||||||
if let Some(true) = skip_next {
|
if matches!(skip_next, Some(true)) {
|
||||||
// Reset state; skip this iteration.
|
// Reset state; skip this iteration.
|
||||||
*skip_next = None;
|
*skip_next = None;
|
||||||
Some(None)
|
return Some(None);
|
||||||
} else if !include_index_url
|
}
|
||||||
&& (arg.starts_with("--extra-index-url=") || arg.starts_with("--index-url="))
|
|
||||||
{
|
// Skip any index URLs, unless requested.
|
||||||
|
if !include_index_url {
|
||||||
|
if arg.starts_with("--extra-index-url=") || arg.starts_with("--index-url=") {
|
||||||
// Reset state; skip this iteration.
|
// Reset state; skip this iteration.
|
||||||
*skip_next = None;
|
*skip_next = None;
|
||||||
Some(None)
|
return Some(None);
|
||||||
} else if !include_index_url && (arg == "--extra-index-url" || arg == "--index-url") {
|
}
|
||||||
|
|
||||||
// Mark the next item as (to be) skipped.
|
// Mark the next item as (to be) skipped.
|
||||||
|
if arg == "--index-url" || arg == "--extra-index-url" {
|
||||||
*skip_next = Some(true);
|
*skip_next = Some(true);
|
||||||
Some(None)
|
return Some(None);
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip any `--find-links` URLs, unless requested.
|
||||||
|
if !include_find_links {
|
||||||
|
if arg.starts_with("--find-links=") || arg.starts_with("-f=") {
|
||||||
|
// Reset state; skip this iteration.
|
||||||
|
*skip_next = None;
|
||||||
|
return Some(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mark the next item as (to be) skipped.
|
||||||
|
if arg == "--find-links" || arg == "-f" {
|
||||||
|
*skip_next = Some(true);
|
||||||
|
return Some(None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return the argument.
|
// Return the argument.
|
||||||
Some(Some(arg))
|
Some(Some(arg))
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.flatten()
|
.flatten()
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|
|
||||||
|
|
@ -2889,7 +2889,7 @@ fn find_links_directory() -> Result<()> {
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in --find-links [PROJECT_ROOT]/scripts/wheels
|
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in
|
||||||
markupsafe==2.1.3
|
markupsafe==2.1.3
|
||||||
# via werkzeug
|
# via werkzeug
|
||||||
numpy==1.26.2
|
numpy==1.26.2
|
||||||
|
|
@ -2919,7 +2919,7 @@ fn find_links_url() -> Result<()> {
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in --no-index --find-links https://download.pytorch.org/whl/torch_stable.html
|
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2023-11-18T12:00:00Z requirements.in --no-index
|
||||||
tqdm==4.64.1
|
tqdm==4.64.1
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ fn requires_incompatible_python_version_compatible_override() -> Result<()> {
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile requirements.in --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.11
|
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
|
||||||
albatross==1.0.0
|
albatross==1.0.0
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
@ -244,7 +244,7 @@ fn requires_incompatible_python_version_compatible_override_no_wheels_available_
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile requirements.in --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.11
|
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
|
||||||
albatross==1.0.0
|
albatross==1.0.0
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
@ -464,7 +464,7 @@ fn requires_python_patch_version_override_patch_compatible() -> Result<()> {
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile requirements.in --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.8.0
|
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.8.0
|
||||||
albatross==1.0.0
|
albatross==1.0.0
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue