diff --git a/tools/setup_dependencies.sh b/tools/setup_dependencies.sh index 7c0bf7d70..a3b2f68bf 100755 --- a/tools/setup_dependencies.sh +++ b/tools/setup_dependencies.sh @@ -4,6 +4,21 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" ROOT="$(cd "$DIR/../" && pwd)" +function retry() { + local attempts=$1 + shift + for i in $(seq 1 "$attempts"); do + if "$@"; then + return 0 + fi + if [ "$i" -lt "$attempts" ]; then + echo " Attempt $i/$attempts failed, retrying in 5s..." + sleep 5 + fi + done + return 1 +} + function install_ubuntu_deps() { SUDO="" @@ -83,7 +98,8 @@ function install_python_deps() { if ! command -v "uv" > /dev/null 2>&1; then echo "installing uv..." - curl -LsSf --retry 5 --retry-delay 5 --retry-all-errors https://astral.sh/uv/install.sh | sh + # TODO: outer retry can be removed once https://github.com/axodotdev/cargo-dist/pull/2311 is merged + retry 3 sh -c 'curl --retry 5 --retry-delay 5 --retry-all-errors -LsSf https://astral.sh/uv/install.sh | UV_GITHUB_TOKEN="${GITHUB_TOKEN:-}" sh' UV_BIN="$HOME/.local/bin" PATH="$UV_BIN:$PATH" fi