diff --git a/.evergreen/scripts/install-rust.sh b/.evergreen/scripts/install-rust.sh index 80c685e6b..fbd2a325d 100755 --- a/.evergreen/scripts/install-rust.sh +++ b/.evergreen/scripts/install-rust.sh @@ -25,10 +25,25 @@ else export PATH="$HOME/.cargo/bin:$PATH" else # Unix-like installation (Linux, macOS) + # Ensure CARGO_HOME is exported so rustup uses it + export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" + export RUSTUP_HOME="${RUSTUP_HOME:-${CARGO_HOME}}" + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable - # Source cargo env - source "$HOME/.cargo/env" + # Source cargo env from the installation location + # On CI, CARGO_HOME is set to ${DRIVERS_TOOLS}/.cargo by configure-env.sh + CARGO_ENV_PATH="${CARGO_HOME}/env" + + if [ -f "${CARGO_ENV_PATH}" ]; then + source "${CARGO_ENV_PATH}" + else + echo "Error: Cargo env file not found at ${CARGO_ENV_PATH}" + echo "CARGO_HOME=${CARGO_HOME}" + echo "RUSTUP_HOME=${RUSTUP_HOME}" + echo "HOME=${HOME}" + exit 1 + fi fi echo "Rust installation complete:" @@ -39,7 +54,9 @@ fi # Install maturin if not already installed if ! command -v maturin &> /dev/null; then echo "Installing maturin..." - cargo install maturin + # Use pip instead of cargo to avoid yanked dependency issues + # (e.g., maturin 1.12.2 depends on cargo-xwin which has yanked xwin versions) + pip install maturin echo "maturin installation complete:" maturin --version else