From e83835de1e48a11464e4e2e4251d6b0c2bb552fd Mon Sep 17 00:00:00 2001 From: Lucas Parzianello Date: Tue, 29 Oct 2024 00:05:49 -0400 Subject: [PATCH 1/2] uv step: checking self subcommand exits; fixes #942 --- src/steps/generic.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index f25f0fae..3d8e9e39 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -1032,15 +1032,20 @@ pub fn run_uv(ctx: &ExecutionContext) -> Result<()> { let uv_exec = require("uv")?; print_separator("uv"); - ctx.run_type() + // try uv self --help first - if it succeeds, we call uv self update + let result = ctx + .run_type() .execute(&uv_exec) - .args(["self", "update"]) - .status_checked() - .ok(); + .args(["self", "--help"]) + .output_checked(); - // ignoring self-update errors, because they are likely due to uv's - // installation being managed by another package manager, in which - // case another step will handle the update. + if result.is_ok() { + return ctx + .run_type() + .execute(&uv_exec) + .args(["self", "update"]) + .status_checked(); + } ctx.run_type() .execute(&uv_exec) From 170d0879b23c81bf47b6a7f598522fba120c9f27 Mon Sep 17 00:00:00 2001 From: Lucas Parzianello Date: Tue, 29 Oct 2024 02:55:18 -0400 Subject: [PATCH 2/2] uv: fixing return behavior --- src/steps/generic.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 3d8e9e39..ba3e1a2c 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -1040,11 +1040,11 @@ pub fn run_uv(ctx: &ExecutionContext) -> Result<()> { .output_checked(); if result.is_ok() { - return ctx - .run_type() + ctx.run_type() .execute(&uv_exec) .args(["self", "update"]) - .status_checked(); + .status_checked() + .ok(); } ctx.run_type()