mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-27 20:49:13 +00:00
Avoid writing duplicate index URLs with --emit-index-url
(#8226)
closes #8116 --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
0c445eb11d
commit
0bd6e46bcf
2 changed files with 8 additions and 3 deletions
|
@ -4,6 +4,7 @@ use std::path::Path;
|
|||
use anyhow::{anyhow, Result};
|
||||
use itertools::Itertools;
|
||||
use owo_colors::OwoColorize;
|
||||
use rustc_hash::FxHashSet;
|
||||
use tracing::debug;
|
||||
|
||||
use uv_cache::Cache;
|
||||
|
@ -466,9 +467,12 @@ pub(crate) async fn pip_compile(
|
|||
writeln!(writer, "--index-url {}", index.url().verbatim())?;
|
||||
wrote_preamble = true;
|
||||
}
|
||||
let mut seen = FxHashSet::default();
|
||||
for extra_index in index_locations.implicit_indexes() {
|
||||
writeln!(writer, "--extra-index-url {}", extra_index.url().verbatim())?;
|
||||
wrote_preamble = true;
|
||||
if seen.insert(extra_index.url()) {
|
||||
writeln!(writer, "--extra-index-url {}", extra_index.url().verbatim())?;
|
||||
wrote_preamble = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5263,7 +5263,8 @@ fn emit_index_urls() -> Result<()> {
|
|||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.arg("--extra-index-url")
|
||||
.arg("https://pypi.org/simple"), @r###"
|
||||
.arg("https://pypi.org/simple")
|
||||
.env("UV_EXTRA_INDEX_URL", "https://pypi.org/simple"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue