Conda (fix #829) (#832)

This commit is contained in:
Roey Darwish Dror
2022-01-15 06:50:42 +02:00
committed by GitHub
parent f21ba9d495
commit 54741ff899
3 changed files with 23 additions and 8 deletions

View File

@@ -76,6 +76,7 @@ pub enum Step {
Chocolatey,
Choosenim,
Composer,
Conda,
CustomCommands,
Deno,
Dotnet,

View File

@@ -295,6 +295,7 @@ fn run() -> Result<()> {
runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?;
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_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::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?;
runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?;

View File

@@ -1,4 +1,15 @@
#![allow(unused_imports)]
use std::path::PathBuf;
use std::process::Command;
use std::{env, path::Path};
use std::{fs, io::Write};
use anyhow::Result;
use directories::BaseDirs;
use log::debug;
use tempfile::tempfile_in;
use crate::execution_context::ExecutionContext;
use crate::executor::{CommandExt, ExecutorOutput, RunType};
use crate::terminal::{print_separator, shell};
@@ -7,14 +18,6 @@ use crate::{
error::{SkipStep, TopgradeError},
terminal::print_warning,
};
use anyhow::Result;
use directories::BaseDirs;
use log::debug;
use std::path::PathBuf;
use std::process::Command;
use std::{env, path::Path};
use std::{fs, io::Write};
use tempfile::tempfile_in;
pub fn run_cargo_update(ctx: &ExecutionContext) -> Result<()> {
let cargo_dir = env::var_os("CARGO_HOME")
@@ -226,6 +229,16 @@ pub fn run_pipx_update(run_type: RunType) -> Result<()> {
run_type.execute(&pipx).arg("upgrade-all").check_run()
}
pub fn run_conda_update(ctx: &ExecutionContext) -> Result<()> {
let conda = utils::require("conda")?;
print_separator("Conda");
ctx.run_type()
.execute(&conda)
.args(&["update", "--all", "-y"])
.check_run()
}
pub fn run_pip3_update(run_type: RunType) -> Result<()> {
let pip3 = utils::require("pip3")?;
print_separator("pip3");