Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .evergreen/hatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ if [ -n "$SKIP_HATCH" ]; then
run_hatch() {
bash ./.evergreen/run-tests.sh
}
elif $PYTHON_BINARY -m hatch --version; then
run_hatch() {
$PYTHON_BINARY -m hatch run "$@"
}
else # No toolchain hatch present, set up virtualenv before installing hatch
else # Set up virtualenv before installing hatch
# Use a random venv name because the encryption tasks run this script multiple times in the same run.
ENV_NAME=hatchenv-$RANDOM
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
# shellcheck disable=SC2064
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
python -m pip install -q hatch

# Ensure hatch does not write to user or global locations.
touch hatch_config.toml
HATCH_CONFIG=$(pwd)/hatch_config.toml
export HATCH_CONFIG
hatch config restore
hatch config set dirs.data ".hatch/data"
hatch config set dirs.cache ".hatch/cache"

run_hatch() {
python -m hatch run "$@"
}
Expand Down
Loading