mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25: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)]
|
||||
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.
|
||||
///
|
||||
/// 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")]
|
||||
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.
|
||||
///
|
||||
/// 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,
|
||||
keyring_provider,
|
||||
config_setting,
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode,
|
||||
no_compile_bytecode,
|
||||
|
@ -88,6 +89,7 @@ impl From<InstallerArgs> for PipOptions {
|
|||
keyring_provider,
|
||||
config_settings: config_setting
|
||||
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
||||
..PipOptions::from(index_args)
|
||||
|
@ -174,6 +176,7 @@ pub fn installer_options(installer_args: InstallerArgs, build_args: BuildArgs) -
|
|||
index_strategy,
|
||||
keyring_provider,
|
||||
config_setting,
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode,
|
||||
no_compile_bytecode,
|
||||
|
@ -208,6 +211,7 @@ pub fn installer_options(installer_args: InstallerArgs, build_args: BuildArgs) -
|
|||
keyring_provider,
|
||||
config_settings: config_setting
|
||||
.map(|config_settings| config_settings.into_iter().collect::<ConfigSettings>()),
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode: flag(compile_bytecode, no_compile_bytecode),
|
||||
no_build: flag(no_build, build),
|
||||
|
|
|
@ -76,6 +76,7 @@ pub struct InstallerOptions {
|
|||
pub index_strategy: Option<IndexStrategy>,
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
pub config_settings: Option<ConfigSettings>,
|
||||
pub exclude_newer: Option<ExcludeNewer>,
|
||||
pub link_mode: Option<LinkMode>,
|
||||
pub compile_bytecode: Option<bool>,
|
||||
pub reinstall: Option<bool>,
|
||||
|
|
|
@ -105,6 +105,7 @@ pub(super) async fn do_sync(
|
|||
index_strategy,
|
||||
keyring_provider,
|
||||
config_setting,
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode,
|
||||
reinstall,
|
||||
|
@ -149,7 +150,6 @@ pub(super) async fn do_sync(
|
|||
// optional on the downstream APIs.
|
||||
let build_isolation = BuildIsolation::default();
|
||||
let dry_run = false;
|
||||
let exclude_newer = None;
|
||||
let hasher = HashStrategy::default();
|
||||
let setup_py = SetupPyStrategy::default();
|
||||
|
||||
|
|
|
@ -746,7 +746,6 @@ impl PipSyncSettings {
|
|||
constraint,
|
||||
installer,
|
||||
refresh,
|
||||
exclude_newer,
|
||||
require_hashes,
|
||||
no_require_hashes,
|
||||
python,
|
||||
|
@ -787,7 +786,6 @@ impl PipSyncSettings {
|
|||
python,
|
||||
system: flag(system, no_system),
|
||||
break_system_packages: flag(break_system_packages, no_break_system_packages),
|
||||
exclude_newer,
|
||||
target,
|
||||
prefix,
|
||||
require_hashes: flag(require_hashes, no_require_hashes),
|
||||
|
@ -1232,6 +1230,7 @@ pub(crate) struct InstallerSettings {
|
|||
pub(crate) index_strategy: IndexStrategy,
|
||||
pub(crate) keyring_provider: KeyringProviderType,
|
||||
pub(crate) config_setting: ConfigSettings,
|
||||
pub(crate) exclude_newer: Option<ExcludeNewer>,
|
||||
pub(crate) link_mode: LinkMode,
|
||||
pub(crate) compile_bytecode: bool,
|
||||
pub(crate) reinstall: Reinstall,
|
||||
|
@ -1244,6 +1243,7 @@ pub(crate) struct InstallerSettingsRef<'a> {
|
|||
pub(crate) index_strategy: IndexStrategy,
|
||||
pub(crate) keyring_provider: KeyringProviderType,
|
||||
pub(crate) config_setting: &'a ConfigSettings,
|
||||
pub(crate) exclude_newer: Option<ExcludeNewer>,
|
||||
pub(crate) link_mode: LinkMode,
|
||||
pub(crate) compile_bytecode: bool,
|
||||
pub(crate) reinstall: &'a Reinstall,
|
||||
|
@ -1263,7 +1263,7 @@ impl InstallerSettings {
|
|||
resolution: _,
|
||||
prerelease: _,
|
||||
config_settings,
|
||||
exclude_newer: _,
|
||||
exclude_newer,
|
||||
link_mode,
|
||||
compile_bytecode,
|
||||
upgrade: _,
|
||||
|
@ -1300,6 +1300,7 @@ impl InstallerSettings {
|
|||
.config_settings
|
||||
.combine(config_settings)
|
||||
.unwrap_or_default(),
|
||||
exclude_newer: args.exclude_newer.combine(exclude_newer),
|
||||
link_mode: args.link_mode.combine(link_mode).unwrap_or_default(),
|
||||
compile_bytecode: args
|
||||
.compile_bytecode
|
||||
|
@ -1334,6 +1335,7 @@ impl InstallerSettings {
|
|||
index_strategy: self.index_strategy,
|
||||
keyring_provider: self.keyring_provider,
|
||||
config_setting: &self.config_setting,
|
||||
exclude_newer: self.exclude_newer,
|
||||
link_mode: self.link_mode,
|
||||
compile_bytecode: self.compile_bytecode,
|
||||
reinstall: &self.reinstall,
|
||||
|
@ -1958,6 +1960,7 @@ impl<'a> From<ResolverInstallerSettingsRef<'a>> for InstallerSettingsRef<'a> {
|
|||
index_strategy: settings.index_strategy,
|
||||
keyring_provider: settings.keyring_provider,
|
||||
config_setting: settings.config_setting,
|
||||
exclude_newer: settings.exclude_newer,
|
||||
link_mode: settings.link_mode,
|
||||
compile_bytecode: settings.compile_bytecode,
|
||||
reinstall: settings.reinstall,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue