From 536d3cc4fc7623fe0bd80d8a3e3c3f486e97a142 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Tue, 17 Feb 2026 09:45:37 -0500 Subject: [PATCH] Fix maturin installation by using pip instead of cargo The cargo install method was failing due to yanked xwin dependencies (versions 0.6.6 and 0.6.7) in the cargo-xwin package that maturin depends on. Using pip install instead downloads a pre-built binary from PyPI, avoiding the compilation and dependency issue entirely. This aligns with how maturin is installed in other parts of the codebase (bson/_rbson/build.sh and hatch_build.py). --- .evergreen/scripts/install-rust.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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