mirror of
https://github.com/trailofbits/buttercup
synced 2026-06-21 14:11:39 +00:00
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:
committed by
GitHub
parent
e516fe42fb
commit
1b8bd65986
+15
-1
@@ -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..."
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user