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).
This commit is contained in:
Jeffrey A. Clark 2026-02-17 09:45:37 -05:00 committed by Jeffrey 'Alex' Clark
parent c40e860603
commit 536d3cc4fc

View File

@ -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