From 1bb896839d1ea7d5bee979586135c0500def9334 Mon Sep 17 00:00:00 2001 From: Amir Mohammadi <5738695+183amir@users.noreply.github.com> Date: Fri, 20 Sep 2024 21:17:54 +0200 Subject: [PATCH] refactor(cli): remove --no-activation flag from global upgrade commands for simplification and standardization --- docs/reference/cli.md | 7 ------- pixi.lock | 32 +++++++++++++++--------------- src/cli/global/install.rs | 2 +- src/cli/global/upgrade.rs | 16 ++------------- src/cli/global/upgrade_all.rs | 13 +----------- tests/integration/test_main_cli.py | 12 ----------- 6 files changed, 20 insertions(+), 62 deletions(-) diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 4be6712db..069bae28b 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -1001,7 +1001,6 @@ This command upgrades a globally installed package (to the latest version by def Defaults to `conda-forge`. Note the channel the package was installed from will be always used for upgrade. (Allowed to be used more than once) - `--platform (-p)`: specify a platform that you want to upgrade the package for. (default: current platform) -- `--no-activation`: Do not insert conda_prefix, path modifications, and activation script into the installed executable script. ```shell pixi global upgrade ruff @@ -1013,9 +1012,6 @@ pixi global upgrade -c conda-forge -c bioconda trackplot # You can specify the version to upgrade to when you don't want the latest version # or you can even use it to downgrade a globally installed package pixi global upgrade python=3.10 - -# Upgrade without inserting activation code into the executable script -pixi global upgrade ruff --no-activation ``` ### `global upgrade-all` @@ -1027,15 +1023,12 @@ This command upgrades all globally installed packages to their latest version. - `--channel (-c)`: specify a channel that the project uses. Defaults to `conda-forge`. Note the channel the package was installed from will be always used for upgrade. (Allowed to be used more than once) -- `--no-activation`: Do not insert conda_prefix, path modifications, and activation script into the installed executable scripts. ```shell pixi global upgrade-all pixi global upgrade-all --channel conda-forge --channel bioconda # Or in a more concise form pixi global upgrade-all -c conda-forge -c bioconda trackplot -# Upgrade all without inserting activation code into the executable scripts -pixi global upgrade-all --no-activation ``` ### `global remove` diff --git a/pixi.lock b/pixi.lock index b1b6a5615..dbdaae103 100644 --- a/pixi.lock +++ b/pixi.lock @@ -15,7 +15,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/binutils_linux-64-2.40-hb3c18ed_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/brotli-python-1.1.0-py312h30efb56_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-h4bc722e_7.conda - - conda: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.32.3-h4bc722e_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.33.1-heb4867d_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/c-compiler-1.7.0-hd590300_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2024.8.30-hbcca054_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/certifi-2024.7.4-pyhd8ed1ab_0.conda @@ -1647,21 +1647,6 @@ packages: license_family: BSD size: 134188 timestamp: 1720974491916 -- kind: conda - name: c-ares - version: 1.32.3 - build: h4bc722e_0 - subdir: linux-64 - url: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.32.3-h4bc722e_0.conda - sha256: 3c5a844bb60b0d52d89c3f1bd828c9856417fe33a6102fd8bbd5c13c3351704a - md5: 7624e34ee6baebfc80d67bac76cc9d9d - depends: - - __glibc >=2.17,<3.0.a0 - - libgcc-ng >=12 - license: MIT - license_family: MIT - size: 179736 - timestamp: 1721834714515 - kind: conda name: c-ares version: 1.33.1 @@ -1690,6 +1675,21 @@ packages: license_family: MIT size: 159389 timestamp: 1724438175204 +- kind: conda + name: c-ares + version: 1.33.1 + build: heb4867d_0 + subdir: linux-64 + url: https://conda.anaconda.org/conda-forge/linux-64/c-ares-1.33.1-heb4867d_0.conda + sha256: 2cb24f613eaf2850b1a08f28f967b10d8bd44ef623efa0154dc45eb718776be6 + md5: 0d3c60291342c0c025db231353376dfb + depends: + - __glibc >=2.28,<3.0.a0 + - libgcc-ng >=13 + license: MIT + license_family: MIT + size: 182796 + timestamp: 1724438109690 - kind: conda name: c-compiler version: 1.7.0 diff --git a/src/cli/global/install.rs b/src/cli/global/install.rs index 5a55db9e6..fde4625e0 100644 --- a/src/cli/global/install.rs +++ b/src/cli/global/install.rs @@ -231,7 +231,7 @@ pub(super) async fn create_executable_scripts( } } else { activation_script.clone() - } + }; shell .run_command( diff --git a/src/cli/global/upgrade.rs b/src/cli/global/upgrade.rs index a4f9348f9..7c6c64c2a 100644 --- a/src/cli/global/upgrade.rs +++ b/src/cli/global/upgrade.rs @@ -30,10 +30,6 @@ pub struct Args { /// The platform to install the package for. #[clap(long, default_value_t = Platform::current())] platform: Platform, - - /// Do not insert conda_prefix, path modifications, and activation script into the installed executable script. - #[clap(long)] - no_activation: bool, } impl HasSpecs for Args { @@ -45,14 +41,7 @@ impl HasSpecs for Args { pub async fn execute(args: Args) -> miette::Result<()> { let config = Config::load_global(); let specs = args.specs()?; - upgrade_packages( - specs, - config, - args.channels, - args.platform, - args.no_activation, - ) - .await + upgrade_packages(specs, config, args.channels, args.platform).await } pub(super) async fn upgrade_packages( @@ -60,7 +49,6 @@ pub(super) async fn upgrade_packages( config: Config, cli_channels: ChannelsConfig, platform: Platform, - no_activation: bool, ) -> miette::Result<()> { let channel_cli = cli_channels.resolve_from_config(&config); @@ -212,7 +200,7 @@ pub(super) async fn upgrade_packages( records, authenticated_client.clone(), platform, - no_activation, + false, ) .await?; pb.finish_with_message(format!("{} {}", console::style("Updated").green(), message)); diff --git a/src/cli/global/upgrade_all.rs b/src/cli/global/upgrade_all.rs index b85c41685..be72d5565 100644 --- a/src/cli/global/upgrade_all.rs +++ b/src/cli/global/upgrade_all.rs @@ -21,10 +21,6 @@ pub struct Args { /// The platform to install the package for. #[clap(long, default_value_t = Platform::current())] platform: Platform, - - /// Do not insert conda_prefix, path modifications, and activation script into the installed executable script. - #[clap(long)] - no_activation: bool, } pub async fn execute(args: Args) -> miette::Result<()> { @@ -42,12 +38,5 @@ pub async fn execute(args: Args) -> miette::Result<()> { ); } - upgrade_packages( - specs, - config, - args.channels, - args.platform, - args.no_activation, - ) - .await + upgrade_packages(specs, config, args.channels, args.platform).await } diff --git a/tests/integration/test_main_cli.py b/tests/integration/test_main_cli.py index f865ee580..64d8174b8 100644 --- a/tests/integration/test_main_cli.py +++ b/tests/integration/test_main_cli.py @@ -195,21 +195,9 @@ def test_global_install(pixi: Path) -> None: # Upgrade verify_cli_command([pixi, "global", "upgrade", "rattler-build"], ExitCode.SUCCESS) - # Upgrade with --no-activation - verify_cli_command( - [pixi, "global", "upgrade", "rattler-build", "--no-activation"], - ExitCode.SUCCESS, - ) - # Upgrade all verify_cli_command([pixi, "global", "upgrade-all"], ExitCode.SUCCESS) - # Upgrade all with --no-activation - verify_cli_command( - [pixi, "global", "upgrade-all", "--no-activation"], - ExitCode.SUCCESS, - ) - # List verify_cli_command([pixi, "global", "list"], ExitCode.SUCCESS, stderr_contains="rattler-build")