Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make --reinstall, --upgrade, and --refresh shared arguments #4319

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/uv-settings/src/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ impl Combine for ResolverInstallerOptions {
exclude_newer: self.exclude_newer.combine(other.exclude_newer),
link_mode: self.link_mode.combine(other.link_mode),
compile_bytecode: self.compile_bytecode.combine(other.compile_bytecode),
upgrade: self.upgrade.combine(other.upgrade),
upgrade_package: self.upgrade_package.combine(other.upgrade_package),
reinstall: self.reinstall.combine(other.reinstall),
reinstall_package: self.reinstall_package.combine(other.reinstall_package),
}
}
}
Expand Down Expand Up @@ -142,6 +146,10 @@ impl Combine for PipOptions {
link_mode: self.link_mode.combine(other.link_mode),
compile_bytecode: self.compile_bytecode.combine(other.compile_bytecode),
require_hashes: self.require_hashes.combine(other.require_hashes),
upgrade: self.upgrade.combine(other.upgrade),
upgrade_package: self.upgrade_package.combine(other.upgrade_package),
reinstall: self.reinstall.combine(other.reinstall),
reinstall_package: self.reinstall_package.combine(other.reinstall_package),
concurrent_downloads: self
.concurrent_downloads
.combine(other.concurrent_downloads),
Expand Down
24 changes: 24 additions & 0 deletions crates/uv-settings/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ pub struct InstallerOptions {
pub config_settings: Option<ConfigSettings>,
pub link_mode: Option<LinkMode>,
pub compile_bytecode: Option<bool>,
pub reinstall: Option<bool>,
pub reinstall_package: Option<Vec<PackageName>>,
}

/// Settings relevant to all resolver operations.
Expand All @@ -94,6 +96,8 @@ pub struct ResolverOptions {
pub config_settings: Option<ConfigSettings>,
pub exclude_newer: Option<ExcludeNewer>,
pub link_mode: Option<LinkMode>,
pub upgrade: Option<bool>,
pub upgrade_package: Option<Vec<PackageName>>,
}

/// Shared settings, relevant to all operations that must resolve and install dependencies. The
Expand All @@ -115,6 +119,10 @@ pub struct ResolverInstallerOptions {
pub exclude_newer: Option<ExcludeNewer>,
pub link_mode: Option<LinkMode>,
pub compile_bytecode: Option<bool>,
pub upgrade: Option<bool>,
pub upgrade_package: Option<Vec<PackageName>>,
pub reinstall: Option<bool>,
pub reinstall_package: Option<Vec<PackageName>>,
}

/// A `[tool.uv.pip]` section.
Expand Down Expand Up @@ -164,6 +172,10 @@ pub struct PipOptions {
pub link_mode: Option<LinkMode>,
pub compile_bytecode: Option<bool>,
pub require_hashes: Option<bool>,
pub upgrade: Option<bool>,
pub upgrade_package: Option<Vec<PackageName>>,
pub reinstall: Option<bool>,
pub reinstall_package: Option<Vec<PackageName>>,
pub concurrent_downloads: Option<NonZeroUsize>,
pub concurrent_builds: Option<NonZeroUsize>,
pub concurrent_installs: Option<NonZeroUsize>,
Expand Down Expand Up @@ -217,6 +229,10 @@ impl Options {
link_mode,
compile_bytecode,
require_hashes,
upgrade,
upgrade_package,
reinstall,
reinstall_package,
concurrent_builds,
concurrent_downloads,
concurrent_installs,
Expand All @@ -235,6 +251,10 @@ impl Options {
exclude_newer: top_level_exclude_newer,
link_mode: top_level_link_mode,
compile_bytecode: top_level_compile_bytecode,
upgrade: top_level_upgrade,
upgrade_package: top_level_upgrade_package,
reinstall: top_level_reinstall,
reinstall_package: top_level_reinstall_package,
} = self.top_level;

PipOptions {
Expand Down Expand Up @@ -279,6 +299,10 @@ impl Options {
link_mode: link_mode.or(top_level_link_mode),
compile_bytecode: compile_bytecode.or(top_level_compile_bytecode),
require_hashes,
upgrade: upgrade.or(top_level_upgrade),
upgrade_package: upgrade_package.or(top_level_upgrade_package),
reinstall: reinstall.or(top_level_reinstall),
reinstall_package: reinstall_package.or(top_level_reinstall_package),
concurrent_builds,
concurrent_downloads,
concurrent_installs,
Expand Down
Loading
Loading