mirror of https://github.com/astral-sh/uv
Use a `DryRun` enum everywhere (#11303)
## Summary Rather than Yet Another Bool.
This commit is contained in:
parent
51c05df9c9
commit
46a03b5518
|
|
@ -0,0 +1,24 @@
|
|||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum DryRun {
|
||||
/// The operation should execute in dry run mode.
|
||||
Enabled,
|
||||
/// The operation should execute in normal mode.
|
||||
#[default]
|
||||
Disabled,
|
||||
}
|
||||
|
||||
impl DryRun {
|
||||
/// Determine the [`DryRun`] setting based on the command-line arguments.
|
||||
pub fn from_args(dry_run: bool) -> Self {
|
||||
if dry_run {
|
||||
DryRun::Enabled
|
||||
} else {
|
||||
DryRun::Disabled
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if dry run mode is enabled.
|
||||
pub const fn enabled(&self) -> bool {
|
||||
matches!(self, DryRun::Enabled)
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ pub use concurrency::*;
|
|||
pub use config_settings::*;
|
||||
pub use constraints::*;
|
||||
pub use dev::*;
|
||||
pub use dry_run::*;
|
||||
pub use editable::*;
|
||||
pub use export_format::*;
|
||||
pub use extras::*;
|
||||
|
|
@ -28,6 +29,7 @@ mod concurrency;
|
|||
mod config_settings;
|
||||
mod constraints;
|
||||
mod dev;
|
||||
mod dry_run;
|
||||
mod editable;
|
||||
mod export_format;
|
||||
mod extras;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use tracing::{debug, enabled, Level};
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{BaseClientBuilder, Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification,
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification, DryRun,
|
||||
ExtrasSpecification, HashCheckingMode, IndexStrategy, PreviewMode, Reinstall, SourceStrategy,
|
||||
TrustedHost, Upgrade,
|
||||
};
|
||||
|
|
@ -87,7 +87,7 @@ pub(crate) async fn pip_install(
|
|||
native_tls: bool,
|
||||
allow_insecure_host: &[TrustedHost],
|
||||
cache: Cache,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
preview: PreviewMode,
|
||||
) -> anyhow::Result<ExitStatus> {
|
||||
|
|
@ -247,7 +247,7 @@ pub(crate) async fn pip_install(
|
|||
}
|
||||
}
|
||||
DefaultInstallLogger.on_audit(requirements.len(), start, printer)?;
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(printer.stderr(), "Would make no changes")?;
|
||||
}
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ pub(crate) async fn pip_install(
|
|||
operations::diagnose_resolution(resolution.diagnostics(), printer)?;
|
||||
|
||||
// Notify the user of any environment diagnostics.
|
||||
if strict && !dry_run {
|
||||
if strict && !dry_run.enabled() {
|
||||
operations::diagnose_environment(&resolution, &environment, &marker_env, printer)?;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use uv_tool::InstalledTools;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{BaseClientBuilder, RegistryClient};
|
||||
use uv_configuration::{
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification,
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification, DryRun,
|
||||
ExtrasSpecification, Overrides, Reinstall, Upgrade,
|
||||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
|
|
@ -418,7 +418,7 @@ pub(crate) async fn install(
|
|||
venv: &PythonEnvironment,
|
||||
logger: Box<dyn InstallLogger>,
|
||||
installer_metadata: bool,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
) -> Result<Changelog, Error> {
|
||||
let start = std::time::Instant::now();
|
||||
|
|
@ -439,7 +439,7 @@ pub(crate) async fn install(
|
|||
)
|
||||
.context("Failed to determine installation plan")?;
|
||||
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
report_dry_run(resolution, plan, modifications, start, printer)?;
|
||||
return Ok(Changelog::default());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use tracing::debug;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{BaseClientBuilder, Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification,
|
||||
BuildOptions, Concurrency, ConfigSettings, Constraints, DevGroupsSpecification, DryRun,
|
||||
ExtrasSpecification, HashCheckingMode, IndexStrategy, PreviewMode, Reinstall, SourceStrategy,
|
||||
TrustedHost, Upgrade,
|
||||
};
|
||||
|
|
@ -75,7 +75,7 @@ pub(crate) async fn pip_sync(
|
|||
native_tls: bool,
|
||||
allow_insecure_host: &[TrustedHost],
|
||||
cache: Cache,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
preview: PreviewMode,
|
||||
) -> Result<ExitStatus> {
|
||||
|
|
@ -425,7 +425,7 @@ pub(crate) async fn pip_sync(
|
|||
operations::diagnose_resolution(resolution.diagnostics(), printer)?;
|
||||
|
||||
// Notify the user of any environment diagnostics.
|
||||
if strict && !dry_run {
|
||||
if strict && !dry_run.enabled() {
|
||||
operations::diagnose_environment(&resolution, &environment, &marker_env, printer)?;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use tracing::debug;
|
|||
|
||||
use uv_cache::Cache;
|
||||
use uv_client::{BaseClientBuilder, Connectivity};
|
||||
use uv_configuration::{KeyringProviderType, TrustedHost};
|
||||
use uv_configuration::{DryRun, KeyringProviderType, TrustedHost};
|
||||
use uv_distribution_types::{InstalledMetadata, Name, UnresolvedRequirement};
|
||||
use uv_fs::Simplified;
|
||||
use uv_pep508::UnnamedRequirement;
|
||||
|
|
@ -36,7 +36,7 @@ pub(crate) async fn pip_uninstall(
|
|||
native_tls: bool,
|
||||
keyring_provider: KeyringProviderType,
|
||||
allow_insecure_host: &[TrustedHost],
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
) -> Result<ExitStatus> {
|
||||
let start = std::time::Instant::now();
|
||||
|
|
@ -144,7 +144,7 @@ pub(crate) async fn pip_uninstall(
|
|||
for package in &names {
|
||||
let installed = site_packages.get_packages(package);
|
||||
if installed.is_empty() {
|
||||
if !dry_run {
|
||||
if !dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}{} Skipping {} as it is not installed",
|
||||
|
|
@ -162,7 +162,7 @@ pub(crate) async fn pip_uninstall(
|
|||
for url in &urls {
|
||||
let installed = site_packages.get_urls(url);
|
||||
if installed.is_empty() {
|
||||
if !dry_run {
|
||||
if !dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}{} Skipping {} as it is not installed",
|
||||
|
|
@ -183,7 +183,7 @@ pub(crate) async fn pip_uninstall(
|
|||
};
|
||||
|
||||
if distributions.is_empty() {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(printer.stderr(), "Would make no changes")?;
|
||||
} else {
|
||||
writeln!(
|
||||
|
|
@ -197,7 +197,7 @@ pub(crate) async fn pip_uninstall(
|
|||
}
|
||||
|
||||
// Uninstall each package.
|
||||
if !dry_run {
|
||||
if !dry_run.enabled() {
|
||||
for distribution in &distributions {
|
||||
let summary = uv_installer::uninstall(distribution).await?;
|
||||
debug!(
|
||||
|
|
@ -213,7 +213,7 @@ pub(crate) async fn pip_uninstall(
|
|||
|
||||
let uninstalls = distributions.len();
|
||||
let s = if uninstalls == 1 { "" } else { "s" };
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use uv_cache::Cache;
|
|||
use uv_cache_key::RepositoryUrl;
|
||||
use uv_client::{BaseClientBuilder, Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
Concurrency, Constraints, DevGroupsSpecification, DevMode, EditableMode, ExtrasSpecification,
|
||||
InstallOptions, PreviewMode, SourceStrategy, TrustedHost,
|
||||
Concurrency, Constraints, DevGroupsSpecification, DevMode, DryRun, EditableMode,
|
||||
ExtrasSpecification, InstallOptions, PreviewMode, SourceStrategy, TrustedHost,
|
||||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
use uv_distribution::DistributionDatabase;
|
||||
|
|
@ -235,7 +235,7 @@ pub(crate) async fn add(
|
|||
no_config,
|
||||
active,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
)
|
||||
.await?
|
||||
|
|
@ -882,7 +882,7 @@ async fn lock_and_sync(
|
|||
native_tls,
|
||||
allow_insecure_host,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
preview,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ use tracing::debug;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
Concurrency, Constraints, DevGroupsSpecification, ExtrasSpecification, PreviewMode, Reinstall,
|
||||
TrustedHost, Upgrade,
|
||||
Concurrency, Constraints, DevGroupsSpecification, DryRun, ExtrasSpecification, PreviewMode,
|
||||
Reinstall, TrustedHost, Upgrade,
|
||||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
use uv_distribution::DistributionDatabase;
|
||||
|
|
@ -79,7 +79,7 @@ pub(crate) async fn lock(
|
|||
project_dir: &Path,
|
||||
locked: bool,
|
||||
frozen: bool,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
python: Option<String>,
|
||||
install_mirrors: PythonInstallMirrors,
|
||||
settings: ResolverSettings,
|
||||
|
|
@ -146,7 +146,7 @@ pub(crate) async fn lock(
|
|||
|
||||
if locked {
|
||||
LockMode::Locked(&interpreter)
|
||||
} else if dry_run {
|
||||
} else if dry_run.enabled() {
|
||||
LockMode::DryRun(&interpreter)
|
||||
} else {
|
||||
LockMode::Write(&interpreter)
|
||||
|
|
@ -174,7 +174,7 @@ pub(crate) async fn lock(
|
|||
.await
|
||||
{
|
||||
Ok(lock) => {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
// In `--dry-run` mode, show all changes.
|
||||
let mut changed = false;
|
||||
if let LockResult::Changed(previous, lock) = &lock {
|
||||
|
|
@ -1081,13 +1081,13 @@ impl ValidatedLock {
|
|||
#[derive(Debug, Clone)]
|
||||
pub(crate) enum LockEvent<'lock> {
|
||||
Update(
|
||||
bool,
|
||||
DryRun,
|
||||
PackageName,
|
||||
BTreeSet<Option<&'lock Version>>,
|
||||
BTreeSet<Option<&'lock Version>>,
|
||||
),
|
||||
Add(bool, PackageName, BTreeSet<Option<&'lock Version>>),
|
||||
Remove(bool, PackageName, BTreeSet<Option<&'lock Version>>),
|
||||
Add(DryRun, PackageName, BTreeSet<Option<&'lock Version>>),
|
||||
Remove(DryRun, PackageName, BTreeSet<Option<&'lock Version>>),
|
||||
}
|
||||
|
||||
impl<'lock> LockEvent<'lock> {
|
||||
|
|
@ -1095,7 +1095,7 @@ impl<'lock> LockEvent<'lock> {
|
|||
pub(crate) fn detect_changes(
|
||||
existing_lock: Option<&'lock Lock>,
|
||||
new_lock: &'lock Lock,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
) -> impl Iterator<Item = Self> {
|
||||
// Identify the package-versions in the existing lockfile.
|
||||
let mut existing_packages: FxHashMap<&PackageName, BTreeSet<Option<&Version>>> =
|
||||
|
|
@ -1180,7 +1180,13 @@ impl std::fmt::Display for LockEvent<'_> {
|
|||
write!(
|
||||
f,
|
||||
"{} {name} {existing_versions} -> {new_versions}",
|
||||
if *dry_run { "Update" } else { "Updated" }.green().bold()
|
||||
if dry_run.enabled() {
|
||||
"Update"
|
||||
} else {
|
||||
"Updated"
|
||||
}
|
||||
.green()
|
||||
.bold()
|
||||
)
|
||||
}
|
||||
Self::Add(dry_run, name, new_versions) => {
|
||||
|
|
@ -1193,7 +1199,9 @@ impl std::fmt::Display for LockEvent<'_> {
|
|||
write!(
|
||||
f,
|
||||
"{} {name} {new_versions}",
|
||||
if *dry_run { "Add" } else { "Added" }.green().bold()
|
||||
if dry_run.enabled() { "Add" } else { "Added" }
|
||||
.green()
|
||||
.bold()
|
||||
)
|
||||
}
|
||||
Self::Remove(dry_run, name, existing_versions) => {
|
||||
|
|
@ -1206,7 +1214,13 @@ impl std::fmt::Display for LockEvent<'_> {
|
|||
write!(
|
||||
f,
|
||||
"{} {name} {existing_versions}",
|
||||
if *dry_run { "Remove" } else { "Removed" }.red().bold()
|
||||
if dry_run.enabled() {
|
||||
"Remove"
|
||||
} else {
|
||||
"Removed"
|
||||
}
|
||||
.red()
|
||||
.bold()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use uv_cache::Cache;
|
|||
use uv_cache_key::cache_digest;
|
||||
use uv_client::{BaseClientBuilder, Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
Concurrency, Constraints, DevGroupsManifest, DevGroupsSpecification, ExtrasSpecification,
|
||||
PreviewMode, Reinstall, TrustedHost, Upgrade,
|
||||
Concurrency, Constraints, DevGroupsManifest, DevGroupsSpecification, DryRun,
|
||||
ExtrasSpecification, PreviewMode, Reinstall, TrustedHost, Upgrade,
|
||||
};
|
||||
use uv_dispatch::{BuildDispatch, SharedState};
|
||||
use uv_distribution::DistributionDatabase;
|
||||
|
|
@ -962,7 +962,7 @@ impl ProjectEnvironment {
|
|||
no_config: bool,
|
||||
active: Option<bool>,
|
||||
cache: &Cache,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
) -> Result<Self, ProjectError> {
|
||||
// Lock the project environment to avoid synchronization issues.
|
||||
|
|
@ -1020,7 +1020,7 @@ impl ProjectEnvironment {
|
|||
};
|
||||
|
||||
// Under `--dry-run`, avoid modifying the environment.
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
let environment = PythonEnvironment::from_interpreter(interpreter);
|
||||
return Ok(if replace {
|
||||
Self::Replaced(environment, venv)
|
||||
|
|
@ -1508,7 +1508,7 @@ pub(crate) async fn sync_environment(
|
|||
// optional on the downstream APIs.
|
||||
let build_constraints = Constraints::default();
|
||||
let build_hasher = HashStrategy::default();
|
||||
let dry_run = false;
|
||||
let dry_run = DryRun::default();
|
||||
let hasher = HashStrategy::default();
|
||||
|
||||
// Resolve the flat indexes from `--find-links`.
|
||||
|
|
@ -1715,7 +1715,7 @@ pub(crate) async fn update_environment(
|
|||
// optional on the downstream APIs.
|
||||
let build_constraints = Constraints::default();
|
||||
let build_hasher = HashStrategy::default();
|
||||
let dry_run = false;
|
||||
let dry_run = DryRun::default();
|
||||
let extras = ExtrasSpecification::default();
|
||||
let groups = DevGroupsSpecification::default();
|
||||
let hasher = HashStrategy::default();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use tracing::debug;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::Connectivity;
|
||||
use uv_configuration::{
|
||||
Concurrency, DevGroupsSpecification, EditableMode, ExtrasSpecification, InstallOptions,
|
||||
Concurrency, DevGroupsSpecification, DryRun, EditableMode, ExtrasSpecification, InstallOptions,
|
||||
PreviewMode, TrustedHost,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
|
|
@ -233,7 +233,7 @@ pub(crate) async fn remove(
|
|||
no_config,
|
||||
active,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
)
|
||||
.await?
|
||||
|
|
@ -349,7 +349,7 @@ pub(crate) async fn remove(
|
|||
native_tls,
|
||||
allow_insecure_host,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
preview,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use uv_cache::Cache;
|
|||
use uv_cli::ExternalCommand;
|
||||
use uv_client::{BaseClientBuilder, Connectivity};
|
||||
use uv_configuration::{
|
||||
Concurrency, DevGroupsSpecification, EditableMode, ExtrasSpecification, InstallOptions,
|
||||
Concurrency, DevGroupsSpecification, DryRun, EditableMode, ExtrasSpecification, InstallOptions,
|
||||
PreviewMode, SourceStrategy, TrustedHost,
|
||||
};
|
||||
use uv_distribution::LoweredRequirement;
|
||||
|
|
@ -652,7 +652,7 @@ pub(crate) async fn run(
|
|||
no_config,
|
||||
active,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
)
|
||||
.await?
|
||||
|
|
@ -799,7 +799,7 @@ pub(crate) async fn run(
|
|||
native_tls,
|
||||
allow_insecure_host,
|
||||
cache,
|
||||
false,
|
||||
DryRun::Disabled,
|
||||
printer,
|
||||
preview,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use owo_colors::OwoColorize;
|
|||
use uv_cache::Cache;
|
||||
use uv_client::{Connectivity, FlatIndexClient, RegistryClientBuilder};
|
||||
use uv_configuration::{
|
||||
Concurrency, Constraints, DevGroupsManifest, DevGroupsSpecification, EditableMode,
|
||||
Concurrency, Constraints, DevGroupsManifest, DevGroupsSpecification, DryRun, EditableMode,
|
||||
ExtrasSpecification, HashCheckingMode, InstallOptions, PreviewMode, TrustedHost,
|
||||
};
|
||||
use uv_dispatch::BuildDispatch;
|
||||
|
|
@ -49,7 +49,7 @@ pub(crate) async fn sync(
|
|||
project_dir: &Path,
|
||||
locked: bool,
|
||||
frozen: bool,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
active: Option<bool>,
|
||||
all_packages: bool,
|
||||
package: Option<PackageName>,
|
||||
|
|
@ -139,7 +139,7 @@ pub(crate) async fn sync(
|
|||
.await?
|
||||
{
|
||||
ProjectEnvironment::Existing(environment) => {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
|
|
@ -153,7 +153,7 @@ pub(crate) async fn sync(
|
|||
environment
|
||||
}
|
||||
ProjectEnvironment::Replaced(environment, root) => {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
|
|
@ -167,7 +167,7 @@ pub(crate) async fn sync(
|
|||
environment
|
||||
}
|
||||
ProjectEnvironment::New(environment, root) => {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
|
|
@ -190,7 +190,7 @@ pub(crate) async fn sync(
|
|||
LockMode::Frozen
|
||||
} else if locked {
|
||||
LockMode::Locked(environment.interpreter())
|
||||
} else if dry_run {
|
||||
} else if dry_run.enabled() {
|
||||
LockMode::DryRun(environment.interpreter())
|
||||
} else {
|
||||
LockMode::Write(environment.interpreter())
|
||||
|
|
@ -215,7 +215,7 @@ pub(crate) async fn sync(
|
|||
.await
|
||||
{
|
||||
Ok(result) => {
|
||||
if dry_run {
|
||||
if dry_run.enabled() {
|
||||
match result {
|
||||
LockResult::Unchanged(..) => {
|
||||
writeln!(
|
||||
|
|
@ -364,7 +364,7 @@ pub(super) async fn do_sync(
|
|||
native_tls: bool,
|
||||
allow_insecure_host: &[TrustedHost],
|
||||
cache: &Cache,
|
||||
dry_run: bool,
|
||||
dry_run: DryRun,
|
||||
printer: Printer,
|
||||
preview: PreviewMode,
|
||||
) -> Result<(), ProjectError> {
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ use uv_cli::{
|
|||
};
|
||||
use uv_client::Connectivity;
|
||||
use uv_configuration::{
|
||||
BuildOptions, Concurrency, ConfigSettings, DevGroupsSpecification, EditableMode, ExportFormat,
|
||||
ExtrasSpecification, HashCheckingMode, IndexStrategy, InstallOptions, KeyringProviderType,
|
||||
NoBinary, NoBuild, PreviewMode, ProjectBuildBackend, Reinstall, RequiredVersion,
|
||||
SourceStrategy, TargetTriple, TrustedHost, TrustedPublishing, Upgrade, VersionControlSystem,
|
||||
BuildOptions, Concurrency, ConfigSettings, DevGroupsSpecification, DryRun, EditableMode,
|
||||
ExportFormat, ExtrasSpecification, HashCheckingMode, IndexStrategy, InstallOptions,
|
||||
KeyringProviderType, NoBinary, NoBuild, PreviewMode, ProjectBuildBackend, Reinstall,
|
||||
RequiredVersion, SourceStrategy, TargetTriple, TrustedHost, TrustedPublishing, Upgrade,
|
||||
VersionControlSystem,
|
||||
};
|
||||
use uv_distribution_types::{DependencyMetadata, Index, IndexLocations, IndexUrl};
|
||||
use uv_install_wheel::LinkMode;
|
||||
|
|
@ -957,7 +958,7 @@ impl PythonPinSettings {
|
|||
pub(crate) struct SyncSettings {
|
||||
pub(crate) locked: bool,
|
||||
pub(crate) frozen: bool,
|
||||
pub(crate) dry_run: bool,
|
||||
pub(crate) dry_run: DryRun,
|
||||
pub(crate) active: Option<bool>,
|
||||
pub(crate) extras: ExtrasSpecification,
|
||||
pub(crate) dev: DevGroupsSpecification,
|
||||
|
|
@ -1020,7 +1021,7 @@ impl SyncSettings {
|
|||
Self {
|
||||
locked,
|
||||
frozen,
|
||||
dry_run,
|
||||
dry_run: DryRun::from_args(dry_run),
|
||||
active: flag(active, no_active),
|
||||
extras: ExtrasSpecification::from_args(
|
||||
flag(all_extras, no_all_extras).unwrap_or_default(),
|
||||
|
|
@ -1064,7 +1065,7 @@ impl SyncSettings {
|
|||
pub(crate) struct LockSettings {
|
||||
pub(crate) locked: bool,
|
||||
pub(crate) frozen: bool,
|
||||
pub(crate) dry_run: bool,
|
||||
pub(crate) dry_run: DryRun,
|
||||
pub(crate) script: Option<PathBuf>,
|
||||
pub(crate) python: Option<String>,
|
||||
pub(crate) install_mirrors: PythonInstallMirrors,
|
||||
|
|
@ -1095,7 +1096,7 @@ impl LockSettings {
|
|||
Self {
|
||||
locked: check,
|
||||
frozen: check_exists,
|
||||
dry_run,
|
||||
dry_run: DryRun::from_args(dry_run),
|
||||
script,
|
||||
python: python.and_then(Maybe::into_option),
|
||||
refresh: Refresh::from(refresh),
|
||||
|
|
@ -1679,7 +1680,7 @@ pub(crate) struct PipSyncSettings {
|
|||
pub(crate) src_file: Vec<PathBuf>,
|
||||
pub(crate) constraints: Vec<PathBuf>,
|
||||
pub(crate) build_constraints: Vec<PathBuf>,
|
||||
pub(crate) dry_run: bool,
|
||||
pub(crate) dry_run: DryRun,
|
||||
pub(crate) refresh: Refresh,
|
||||
pub(crate) settings: PipSettings,
|
||||
}
|
||||
|
|
@ -1728,7 +1729,7 @@ impl PipSyncSettings {
|
|||
.into_iter()
|
||||
.filter_map(Maybe::into_option)
|
||||
.collect(),
|
||||
dry_run,
|
||||
dry_run: DryRun::from_args(dry_run),
|
||||
refresh: Refresh::from(refresh),
|
||||
settings: PipSettings::combine(
|
||||
PipOptions {
|
||||
|
|
@ -1767,7 +1768,7 @@ pub(crate) struct PipInstallSettings {
|
|||
pub(crate) constraints: Vec<PathBuf>,
|
||||
pub(crate) overrides: Vec<PathBuf>,
|
||||
pub(crate) build_constraints: Vec<PathBuf>,
|
||||
pub(crate) dry_run: bool,
|
||||
pub(crate) dry_run: DryRun,
|
||||
pub(crate) constraints_from_workspace: Vec<Requirement>,
|
||||
pub(crate) overrides_from_workspace: Vec<Requirement>,
|
||||
pub(crate) modifications: Modifications,
|
||||
|
|
@ -1861,7 +1862,7 @@ impl PipInstallSettings {
|
|||
.into_iter()
|
||||
.filter_map(Maybe::into_option)
|
||||
.collect(),
|
||||
dry_run,
|
||||
dry_run: DryRun::from_args(dry_run),
|
||||
constraints_from_workspace,
|
||||
overrides_from_workspace,
|
||||
modifications: if flag(exact, inexact).unwrap_or(false) {
|
||||
|
|
@ -1902,7 +1903,7 @@ impl PipInstallSettings {
|
|||
pub(crate) struct PipUninstallSettings {
|
||||
pub(crate) package: Vec<String>,
|
||||
pub(crate) requirements: Vec<PathBuf>,
|
||||
pub(crate) dry_run: bool,
|
||||
pub(crate) dry_run: DryRun,
|
||||
pub(crate) settings: PipSettings,
|
||||
}
|
||||
|
||||
|
|
@ -1927,7 +1928,7 @@ impl PipUninstallSettings {
|
|||
Self {
|
||||
package,
|
||||
requirements,
|
||||
dry_run,
|
||||
dry_run: DryRun::from_args(dry_run),
|
||||
settings: PipSettings::combine(
|
||||
PipOptions {
|
||||
python: python.and_then(Maybe::into_option),
|
||||
|
|
|
|||
|
|
@ -5595,7 +5595,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -5634,7 +5634,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -5730,14 +5730,14 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.arg("--no-verify-hashes")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -5776,7 +5776,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -5870,14 +5870,14 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.arg("--require-hashes")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -5916,7 +5916,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -6012,14 +6012,14 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.arg("--no-require-hashes")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -6058,7 +6058,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -6152,14 +6152,14 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.env(EnvVars::UV_NO_VERIFY_HASHES, "1")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -6198,7 +6198,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -6292,7 +6292,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
uv_snapshot!(context.filters(), add_shared_args(context.pip_install(), context.temp_dir.path())
|
||||
|
|
@ -6300,7 +6300,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
.arg("requirements.in")
|
||||
.arg("--verify-hashes")
|
||||
.arg("--no-require-hashes")
|
||||
.arg("--show-settings"), @r#"
|
||||
.arg("--show-settings"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
@ -6339,7 +6339,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
constraints: [],
|
||||
overrides: [],
|
||||
build_constraints: [],
|
||||
dry_run: false,
|
||||
dry_run: Disabled,
|
||||
constraints_from_workspace: [],
|
||||
overrides_from_workspace: [],
|
||||
modifications: Sufficient,
|
||||
|
|
@ -6435,7 +6435,7 @@ fn verify_hashes() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
----- stderr -----
|
||||
"#
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Reference in New Issue