mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-14 17:59:46 +00:00
Load credentials for explicit members when lowering (#15844)
## Summary If the target for `uv pip compile` is a `pyproject.toml` in a subdirectory, we won't have loaded the credentials when we go to lower (since it won't be loaded as part of "configuration discovery"). We now add those indexes just-in-time. Closes https://github.com/astral-sh/uv/issues/15362.
This commit is contained in:
parent
43c187dd93
commit
ef17e7d0f4
4 changed files with 85 additions and 16 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
||||
use either::Either;
|
||||
use thiserror::Error;
|
||||
|
|
@ -222,20 +223,20 @@ impl LoweredRequirement {
|
|||
.find(|Index { name, .. }| {
|
||||
name.as_ref().is_some_and(|name| *name == index)
|
||||
})
|
||||
.map(
|
||||
|Index {
|
||||
url, format: kind, ..
|
||||
}| IndexMetadata {
|
||||
url: url.clone(),
|
||||
format: *kind,
|
||||
},
|
||||
)
|
||||
else {
|
||||
return Err(LoweringError::MissingIndex(
|
||||
requirement.name.clone(),
|
||||
index,
|
||||
));
|
||||
};
|
||||
if let Some(credentials) = index.credentials() {
|
||||
let credentials = Arc::new(credentials);
|
||||
uv_auth::store_credentials(index.raw_url(), credentials);
|
||||
}
|
||||
let index = IndexMetadata {
|
||||
url: index.url.clone(),
|
||||
format: index.format,
|
||||
};
|
||||
let conflict = project_name.and_then(|project_name| {
|
||||
if let Some(extra) = extra {
|
||||
Some(ConflictItem::from((project_name.clone(), extra)))
|
||||
|
|
@ -456,20 +457,20 @@ impl LoweredRequirement {
|
|||
.find(|Index { name, .. }| {
|
||||
name.as_ref().is_some_and(|name| *name == index)
|
||||
})
|
||||
.map(
|
||||
|Index {
|
||||
url, format: kind, ..
|
||||
}| IndexMetadata {
|
||||
url: url.clone(),
|
||||
format: *kind,
|
||||
},
|
||||
)
|
||||
else {
|
||||
return Err(LoweringError::MissingIndex(
|
||||
requirement.name.clone(),
|
||||
index,
|
||||
));
|
||||
};
|
||||
if let Some(credentials) = index.credentials() {
|
||||
let credentials = Arc::new(credentials);
|
||||
uv_auth::store_credentials(index.raw_url(), credentials);
|
||||
}
|
||||
let index = IndexMetadata {
|
||||
url: index.url.clone(),
|
||||
format: index.format,
|
||||
};
|
||||
let conflict = None;
|
||||
let source = registry_source(&requirement, index, conflict);
|
||||
(source, marker)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue