Skip to content

Commit

Permalink
refactor(cli): remove --no-activation flag from global upgrade comman…
Browse files Browse the repository at this point in the history
…ds for simplification and standardization
  • Loading branch information
183amir committed Sep 20, 2024
1 parent d3774ab commit 1bb8968
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 62 deletions.
7 changes: 0 additions & 7 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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
Expand All @@ -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`
Expand All @@ -1027,15 +1023,12 @@ This command upgrades all globally installed packages to their latest version.
- `--channel <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`
Expand Down
32 changes: 16 additions & 16 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cli/global/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub(super) async fn create_executable_scripts(
}
} else {
activation_script.clone()
}
};

shell
.run_command(
Expand Down
16 changes: 2 additions & 14 deletions src/cli/global/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -45,22 +41,14 @@ 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(
specs: IndexMap<PackageName, MatchSpec>,
config: Config,
cli_channels: ChannelsConfig,
platform: Platform,
no_activation: bool,
) -> miette::Result<()> {
let channel_cli = cli_channels.resolve_from_config(&config);

Expand Down Expand Up @@ -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));
Expand Down
13 changes: 1 addition & 12 deletions src/cli/global/upgrade_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand All @@ -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
}
12 changes: 0 additions & 12 deletions tests/integration/test_main_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 1bb8968

Please sign in to comment.