mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-28 10:50:29 +00:00
Add --no-sources to avoid reading from tool.uv.sources (#5801)
## Summary Closes https://github.com/astral-sh/uv/issues/5791.
This commit is contained in:
parent
478d32c655
commit
089f50a845
27 changed files with 455 additions and 40 deletions
|
|
@ -9,6 +9,7 @@ pub use name_specifiers::*;
|
|||
pub use overrides::*;
|
||||
pub use package_options::*;
|
||||
pub use preview::*;
|
||||
pub use sources::*;
|
||||
pub use target_triple::*;
|
||||
|
||||
mod authentication;
|
||||
|
|
@ -22,4 +23,5 @@ mod name_specifiers;
|
|||
mod overrides;
|
||||
mod package_options;
|
||||
mod preview;
|
||||
mod sources;
|
||||
mod target_triple;
|
||||
|
|
|
|||
19
crates/uv-configuration/src/sources.rs
Normal file
19
crates/uv-configuration/src/sources.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum SourceStrategy {
|
||||
/// Use `tool.uv.sources` when resolving dependencies.
|
||||
#[default]
|
||||
Enabled,
|
||||
/// Ignore `tool.uv.sources` when resolving dependencies.
|
||||
Disabled,
|
||||
}
|
||||
|
||||
impl SourceStrategy {
|
||||
/// Return the [`SourceStrategy`] from the command-line arguments, if any.
|
||||
pub fn from_args(no_sources: bool) -> Self {
|
||||
if no_sources {
|
||||
Self::Disabled
|
||||
} else {
|
||||
Self::Enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue