mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add --exclude-newer
to installer arguments (#4785)
## Summary We already support this in `pip sync` and have it stubbed to `None` in `sync.
This commit is contained in:
parent
37f15367bb
commit
d24b075b2d
5 changed files with 19 additions and 11 deletions
|
@ -668,13 +668,6 @@ pub struct PipSyncArgs {
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
pub refresh: RefreshArgs,
|
pub refresh: RefreshArgs,
|
||||||
|
|
||||||
/// Limit candidate packages to those that were uploaded prior to the given date.
|
|
||||||
///
|
|
||||||
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
|
|
||||||
/// format (e.g., `2006-12-02`).
|
|
||||||
#[arg(long, env = "UV_EXCLUDE_NEWER")]
|
|
||||||
pub exclude_newer: Option<ExcludeNewer>,
|
|
||||||
|
|
||||||
/// Require a matching hash for each requirement.
|
/// Require a matching hash for each requirement.
|
||||||
///
|
///
|
||||||
/// Hash-checking mode is all or nothing. If enabled, _all_ requirements must be provided
|
/// Hash-checking mode is all or nothing. If enabled, _all_ requirements must be provided
|
||||||
|
@ -2228,6 +2221,13 @@ pub struct InstallerArgs {
|
||||||
#[arg(long, short = 'C', alias = "config-settings")]
|
#[arg(long, short = 'C', alias = "config-settings")]
|
||||||
pub config_setting: Option<Vec<ConfigSettingEntry>>,
|
pub config_setting: Option<Vec<ConfigSettingEntry>>,
|
||||||
|
|
||||||
|
/// Limit candidate packages to those that were uploaded prior to the given date.
|
||||||
|
///
|
||||||
|
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and UTC dates in the same
|
||||||
|
/// format (e.g., `2006-12-02`).
|
||||||
|
#[arg(long, env = "UV_EXCLUDE_NEWER")]
|
||||||
|
pub exclude_newer: Option<ExcludeNewer>,
|
||||||
|
|
||||||
/// The method to use when installing packages from the global cache.
|
/// The method to use when installing packages from the global cache.
|
||||||
///
|
///
|
||||||
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
|
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
|
||||||
|
|
|
@ -76,6 +76,7 @@ impl From<InstallerArgs> for PipOptions {
|
||||||
index_strategy,
|
index_strategy,
|
||||||
keyring_provider,
|
keyring_provider,
|
||||||
config_setting,
|
config_setting,
|
||||||
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode,
|
compile_bytecode,
|
||||||
no_compile_bytecode,
|
no_compile_bytecode,
|
||||||
|
@ -88,6 +89,7 @@ impl From<InstallerArgs> for PipOptions {
|
||||||
keyring_provider,
|
keyring_provider,
|
||||||
config_settings: config_setting
|
config_settings: config_setting
|
||||||
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
||||||
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
||||||
..PipOptions::from(index_args)
|
..PipOptions::from(index_args)
|
||||||
|
@ -174,6 +176,7 @@ pub fn installer_options(installer_args: InstallerArgs, build_args: BuildArgs) -
|
||||||
index_strategy,
|
index_strategy,
|
||||||
keyring_provider,
|
keyring_provider,
|
||||||
config_setting,
|
config_setting,
|
||||||
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode,
|
compile_bytecode,
|
||||||
no_compile_bytecode,
|
no_compile_bytecode,
|
||||||
|
@ -208,6 +211,7 @@ pub fn installer_options(installer_args: InstallerArgs, build_args: BuildArgs) -
|
||||||
keyring_provider,
|
keyring_provider,
|
||||||
config_settings: config_setting
|
config_settings: config_setting
|
||||||
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
||||||
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
||||||
no_build: flag(no_build, build),
|
no_build: flag(no_build, build),
|
||||||
|
|
|
@ -76,6 +76,7 @@ pub struct InstallerOptions {
|
||||||
pub index_strategy: Option<IndexStrategy>,
|
pub index_strategy: Option<IndexStrategy>,
|
||||||
pub keyring_provider: Option<KeyringProviderType>,
|
pub keyring_provider: Option<KeyringProviderType>,
|
||||||
pub config_settings: Option<ConfigSettings>,
|
pub config_settings: Option<ConfigSettings>,
|
||||||
|
pub exclude_newer: Option<ExcludeNewer>,
|
||||||
pub link_mode: Option<LinkMode>,
|
pub link_mode: Option<LinkMode>,
|
||||||
pub compile_bytecode: Option<bool>,
|
pub compile_bytecode: Option<bool>,
|
||||||
pub reinstall: Option<bool>,
|
pub reinstall: Option<bool>,
|
||||||
|
|
|
@ -105,6 +105,7 @@ pub(super) async fn do_sync(
|
||||||
index_strategy,
|
index_strategy,
|
||||||
keyring_provider,
|
keyring_provider,
|
||||||
config_setting,
|
config_setting,
|
||||||
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode,
|
compile_bytecode,
|
||||||
reinstall,
|
reinstall,
|
||||||
|
@ -149,7 +150,6 @@ pub(super) async fn do_sync(
|
||||||
// optional on the downstream APIs.
|
// optional on the downstream APIs.
|
||||||
let build_isolation = BuildIsolation::default();
|
let build_isolation = BuildIsolation::default();
|
||||||
let dry_run = false;
|
let dry_run = false;
|
||||||
let exclude_newer = None;
|
|
||||||
let hasher = HashStrategy::default();
|
let hasher = HashStrategy::default();
|
||||||
let setup_py = SetupPyStrategy::default();
|
let setup_py = SetupPyStrategy::default();
|
||||||
|
|
||||||
|
|
|
@ -746,7 +746,6 @@ impl PipSyncSettings {
|
||||||
constraint,
|
constraint,
|
||||||
installer,
|
installer,
|
||||||
refresh,
|
refresh,
|
||||||
exclude_newer,
|
|
||||||
require_hashes,
|
require_hashes,
|
||||||
no_require_hashes,
|
no_require_hashes,
|
||||||
python,
|
python,
|
||||||
|
@ -787,7 +786,6 @@ impl PipSyncSettings {
|
||||||
python,
|
python,
|
||||||
system: flag(system, no_system),
|
system: flag(system, no_system),
|
||||||
break_system_packages: flag(break_system_packages, no_break_system_packages),
|
break_system_packages: flag(break_system_packages, no_break_system_packages),
|
||||||
exclude_newer,
|
|
||||||
target,
|
target,
|
||||||
prefix,
|
prefix,
|
||||||
require_hashes: flag(require_hashes, no_require_hashes),
|
require_hashes: flag(require_hashes, no_require_hashes),
|
||||||
|
@ -1232,6 +1230,7 @@ pub(crate) struct InstallerSettings {
|
||||||
pub(crate) index_strategy: IndexStrategy,
|
pub(crate) index_strategy: IndexStrategy,
|
||||||
pub(crate) keyring_provider: KeyringProviderType,
|
pub(crate) keyring_provider: KeyringProviderType,
|
||||||
pub(crate) config_setting: ConfigSettings,
|
pub(crate) config_setting: ConfigSettings,
|
||||||
|
pub(crate) exclude_newer: Option<ExcludeNewer>,
|
||||||
pub(crate) link_mode: LinkMode,
|
pub(crate) link_mode: LinkMode,
|
||||||
pub(crate) compile_bytecode: bool,
|
pub(crate) compile_bytecode: bool,
|
||||||
pub(crate) reinstall: Reinstall,
|
pub(crate) reinstall: Reinstall,
|
||||||
|
@ -1244,6 +1243,7 @@ pub(crate) struct InstallerSettingsRef<'a> {
|
||||||
pub(crate) index_strategy: IndexStrategy,
|
pub(crate) index_strategy: IndexStrategy,
|
||||||
pub(crate) keyring_provider: KeyringProviderType,
|
pub(crate) keyring_provider: KeyringProviderType,
|
||||||
pub(crate) config_setting: &'a ConfigSettings,
|
pub(crate) config_setting: &'a ConfigSettings,
|
||||||
|
pub(crate) exclude_newer: Option<ExcludeNewer>,
|
||||||
pub(crate) link_mode: LinkMode,
|
pub(crate) link_mode: LinkMode,
|
||||||
pub(crate) compile_bytecode: bool,
|
pub(crate) compile_bytecode: bool,
|
||||||
pub(crate) reinstall: &'a Reinstall,
|
pub(crate) reinstall: &'a Reinstall,
|
||||||
|
@ -1263,7 +1263,7 @@ impl InstallerSettings {
|
||||||
resolution: _,
|
resolution: _,
|
||||||
prerelease: _,
|
prerelease: _,
|
||||||
config_settings,
|
config_settings,
|
||||||
exclude_newer: _,
|
exclude_newer,
|
||||||
link_mode,
|
link_mode,
|
||||||
compile_bytecode,
|
compile_bytecode,
|
||||||
upgrade: _,
|
upgrade: _,
|
||||||
|
@ -1300,6 +1300,7 @@ impl InstallerSettings {
|
||||||
.config_settings
|
.config_settings
|
||||||
.combine(config_settings)
|
.combine(config_settings)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
|
exclude_newer: args.exclude_newer.combine(exclude_newer),
|
||||||
link_mode: args.link_mode.combine(link_mode).unwrap_or_default(),
|
link_mode: args.link_mode.combine(link_mode).unwrap_or_default(),
|
||||||
compile_bytecode: args
|
compile_bytecode: args
|
||||||
.compile_bytecode
|
.compile_bytecode
|
||||||
|
@ -1334,6 +1335,7 @@ impl InstallerSettings {
|
||||||
index_strategy: self.index_strategy,
|
index_strategy: self.index_strategy,
|
||||||
keyring_provider: self.keyring_provider,
|
keyring_provider: self.keyring_provider,
|
||||||
config_setting: &self.config_setting,
|
config_setting: &self.config_setting,
|
||||||
|
exclude_newer: self.exclude_newer,
|
||||||
link_mode: self.link_mode,
|
link_mode: self.link_mode,
|
||||||
compile_bytecode: self.compile_bytecode,
|
compile_bytecode: self.compile_bytecode,
|
||||||
reinstall: &self.reinstall,
|
reinstall: &self.reinstall,
|
||||||
|
@ -1958,6 +1960,7 @@ impl<'a> From<ResolverInstallerSettingsRef<'a>> for InstallerSettingsRef<'a> {
|
||||||
index_strategy: settings.index_strategy,
|
index_strategy: settings.index_strategy,
|
||||||
keyring_provider: settings.keyring_provider,
|
keyring_provider: settings.keyring_provider,
|
||||||
config_setting: settings.config_setting,
|
config_setting: settings.config_setting,
|
||||||
|
exclude_newer: settings.exclude_newer,
|
||||||
link_mode: settings.link_mode,
|
link_mode: settings.link_mode,
|
||||||
compile_bytecode: settings.compile_bytecode,
|
compile_bytecode: settings.compile_bytecode,
|
||||||
reinstall: settings.reinstall,
|
reinstall: settings.reinstall,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue