Improve Python version check in installer script to handle errors gracefully
This commit is contained in:
+5
-3
@@ -155,10 +155,12 @@ install_uv() {
|
|||||||
|
|
||||||
check_python() {
|
check_python() {
|
||||||
log_info "Checking Python $PYTHON_VERSION..."
|
log_info "Checking Python $PYTHON_VERSION..."
|
||||||
if "$UV_CMD" python find "$PYTHON_VERSION" </dev/null &>/dev/null; then
|
local py_path
|
||||||
|
py_path="$("$UV_CMD" python find "$PYTHON_VERSION" </dev/null 2>/dev/null)" || true
|
||||||
|
if [ -n "$py_path" ]; then
|
||||||
local ver
|
local ver
|
||||||
ver="$("$UV_CMD" python find "$PYTHON_VERSION" </dev/null | xargs -I{} {} --version 2>&1)"
|
ver="$("$py_path" --version 2>&1)" || true
|
||||||
log_success "$ver found"
|
log_success "${ver:-Python $PYTHON_VERSION} found"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
log_info "Installing Python $PYTHON_VERSION via uv..."
|
log_info "Installing Python $PYTHON_VERSION via uv..."
|
||||||
|
|||||||
Reference in New Issue
Block a user