Adds pyenv step (#724)

This commit is contained in:
Lucas Parzianello
2024-02-26 20:25:18 -05:00
committed by GitHub
parent 9b6027fe78
commit 650a143602
3 changed files with 21 additions and 0 deletions

View File

@@ -121,6 +121,7 @@ pub enum Step {
Pnpm,
Powershell,
Protonup,
Pyenv,
Raco,
Rcm,
Remotes,

View File

@@ -324,6 +324,7 @@ fn run() -> Result<()> {
runner.execute(Step::GnomeShellExtensions, "Gnome Shell Extensions", || {
unix::upgrade_gnome_extensions(&ctx)
})?;
runner.execute(Step::Pyenv, "pyenv", || unix::run_pyenv(&ctx))?;
runner.execute(Step::Sdkman, "SDKMAN!", || unix::run_sdkman(&ctx))?;
runner.execute(Step::Rcm, "rcm", || unix::run_rcm(&ctx))?;
runner.execute(Step::Maza, "maza", || unix::run_maza(&ctx))?;

View File

@@ -580,6 +580,25 @@ pub fn run_pearl(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(pearl).arg("update").status_checked()
}
pub fn run_pyenv(ctx: &ExecutionContext) -> Result<()> {
let pyenv = require("pyenv")?;
print_separator("pyenv");
let pyenv_dir = var("PYENV_ROOT")
.map(PathBuf::from)
.unwrap_or_else(|_| HOME_DIR.join(".pyenv"));
if !pyenv_dir.exists() {
return Err(SkipStep("Pyenv is installed, but $PYENV_ROOT is not set correctly".to_string()).into());
}
if !pyenv_dir.join(".git").exists() {
return Err(SkipStep("pyenv is not a git repository".to_string()).into());
}
ctx.run_type().execute(pyenv).arg("update").status_checked()
}
pub fn run_sdkman(ctx: &ExecutionContext) -> Result<()> {
let bash = require("bash")?;