-
Type:
Task
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
Context
After PYTHON-4631 we should create a single virtual environment for hatch and add it to PATH, and then use that subsequently in tests. We should install rust if installing hatch fails, and then re-install hatch. We can then remove the usages of "SKIP_HATCH" as well.
Example script:
CARGO_HOME=${CARGO_HOME:-${DRIVERS_TOOLS}/.cargo}
# Handle paths on Windows.
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
CARGO_HOME=$(cygpath -m $CARGO_HOME)
fi
# Ensure "hatch" is installed.
if ! command -v hatch > /dev/null; then
# Ensure there is a python venv.
if [ ! -d ${PYTHON_BIN} ]; then
echo "Creating virtual environment..."
. ${DRIVERS_TOOLS}/.evergreen/find-python3.sh
PYTHON_BINARY=$(ensure_python3)
$PYTHON_BINARY -m venv .venv
echo "Creating virtual environment... done."
fi
python --version
echo "Installing hatch..."
python -m pip install -U pip
python -m pip install hatch || {
# Install rust and try again.
export RUSTUP_HOME="${CARGO_HOME}/.rustup"
${DRIVERS_TOOLS}/.evergreen/install-rust.sh
source "${CARGO_HOME}/env"
python -m pip install hatch
}
echo "Installing hatch... done."
fi
hatch --version
Definition of done
Ensure hatch is installed once and available on each platform.
Pitfalls
None
- depends on
-
PYTHON-4631 Remove ${PREPARE_SHELL} Calls
-
- Closed
-