fix(scripts): make install_uv resilient to missing env helper (#547)

The uv installer does not always create $HOME/.local/bin/env (older
versions, or when the install is skipped), so the unconditional `source`
broke setup with `No such file or directory`. Source the helper only if
it exists, prepend $HOME/.local/bin to PATH as a fallback, and fail
loudly if `uv` is still unreachable after install.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Riccardo Schirone
2026-05-18 15:53:06 +02:00
committed by GitHub
parent e516fe42fb
commit 1b8bd65986
+16 -2
View File
@@ -92,8 +92,22 @@ install_uv() {
print_status "Installing uv..."
if ! command_exists uv; then
curl -fsSL https://astral.sh/uv/install.sh | sh
print_status "Sourcing uv environment..."
source "$HOME/.local/bin/env"
print_status "Loading uv into PATH..."
# Newer uv installers drop a helper at $HOME/.local/bin/env; older
# ones do not. Source it when present and always ensure the install
# dir is on PATH so the freshly-installed binary is reachable.
if [ -f "$HOME/.local/bin/env" ]; then
# shellcheck disable=SC1091
source "$HOME/.local/bin/env"
fi
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) export PATH="$HOME/.local/bin:$PATH" ;;
esac
if ! command_exists uv; then
print_error "uv install completed but 'uv' is not on PATH"
return 1
fi
print_success "uv installed successfully"
else
print_success "uv is already installed"