Added support to 'mamba' (alternative to 'conda' with the exact same commands/interface) (#395)
This commit is contained in:
@@ -116,6 +116,7 @@ pub enum Step {
|
|||||||
Helix,
|
Helix,
|
||||||
Krew,
|
Krew,
|
||||||
Macports,
|
Macports,
|
||||||
|
Mamba,
|
||||||
Mas,
|
Mas,
|
||||||
Micro,
|
Micro,
|
||||||
Myrepos,
|
Myrepos,
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ For more information about this issue see https://askubuntu.com/questions/110969
|
|||||||
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(&ctx))?;
|
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(&ctx))?;
|
||||||
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
|
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
|
||||||
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
|
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
|
||||||
|
runner.execute(Step::Mamba, "mamba", || generic::run_mamba_update(&ctx))?;
|
||||||
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
|
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
|
||||||
runner.execute(Step::PipReview, "pip-review", || generic::run_pip_review_update(&ctx))?;
|
runner.execute(Step::PipReview, "pip-review", || generic::run_pip_review_update(&ctx))?;
|
||||||
runner.execute(Step::Pipupgrade, "pipupgrade", || generic::run_pipupgrade_update(&ctx))?;
|
runner.execute(Step::Pipupgrade, "pipupgrade", || generic::run_pipupgrade_update(&ctx))?;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use crate::execution_context::ExecutionContext;
|
|||||||
use crate::executor::{ExecutorOutput, RunType};
|
use crate::executor::{ExecutorOutput, RunType};
|
||||||
use crate::terminal::{print_separator, shell};
|
use crate::terminal::{print_separator, shell};
|
||||||
use crate::utils::{self, require, require_option, which, PathExt};
|
use crate::utils::{self, require, require_option, which, PathExt};
|
||||||
|
use crate::Step;
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{SkipStep, StepFailed, TopgradeError},
|
error::{SkipStep, StepFailed, TopgradeError},
|
||||||
terminal::print_warning,
|
terminal::print_warning,
|
||||||
@@ -332,10 +333,33 @@ pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
|
|
||||||
print_separator("Conda");
|
print_separator("Conda");
|
||||||
|
|
||||||
ctx.run_type()
|
let mut command = ctx.run_type().execute(conda);
|
||||||
.execute(conda)
|
command.args(["update", "--all"]);
|
||||||
.args(["update", "--all", "-y"])
|
if ctx.config().yes(Step::Conda) {
|
||||||
.status_checked()
|
command.arg("--yes");
|
||||||
|
}
|
||||||
|
command.status_checked()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run_mamba_update(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
let mamba = utils::require("mamba")?;
|
||||||
|
|
||||||
|
let output = Command::new("mamba")
|
||||||
|
.args(["config", "--show", "auto_activate_base"])
|
||||||
|
.output_checked_utf8()?;
|
||||||
|
debug!("Mamba output: {}", output.stdout);
|
||||||
|
if output.stdout.contains("False") {
|
||||||
|
return Err(SkipStep("auto_activate_base is set to False".to_string()).into());
|
||||||
|
}
|
||||||
|
|
||||||
|
print_separator("Mamba");
|
||||||
|
|
||||||
|
let mut command = ctx.run_type().execute(mamba);
|
||||||
|
command.args(["update", "--all"]);
|
||||||
|
if ctx.config().yes(Step::Mamba) {
|
||||||
|
command.arg("--yes");
|
||||||
|
}
|
||||||
|
command.status_checked()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_pip3_update(run_type: RunType) -> Result<()> {
|
pub fn run_pip3_update(run_type: RunType) -> Result<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user