Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,8 @@ axes:
display_name: "RHEL 7.x"
run_on: rhel79-small
batchtime: 10080 # 7 days
variables:
SKIP_HATCH: true
- id: rhel8
display_name: "RHEL 8.x"
run_on: rhel8.8-small
Expand Down
67 changes: 49 additions & 18 deletions .evergreen/hatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -o errexit # Exit the script with error if any of the commands fail
set -x

source .evergreen/scripts/env.sh

. .evergreen/utils.sh

if [ -z "$PYTHON_BINARY" ]; then
Expand All @@ -15,23 +17,52 @@ if [ -n "$SKIP_HATCH" ]; then
# shellcheck disable=SC2064
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
python -m pip install -e ".[test]"
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
# 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
run_hatch() {
python -m hatch run "$@"
}
bash ./.evergreen/run-tests.sh
exit 0
fi

run_hatch "${@:1}"
# Bootstrap hatch if needed.
if [ ! -f .bin/hatch ] && [ ! -f .bin/hatch.exe ] ; then
platform="$(uname -s)-$(uname -m)"
case $platform in
Linux-x86_64)
target=x86_64-unknown-linux-gnu.tar.gz
;;
Linux-aarch64)
target=aarch64-unknown-linux-gnu.tar.gz
;;
CYGWIN_NT*)
target=x86_64-pc-windows-msvc.zip
;;
Darwin-x86_64)
target=x86_64-apple-darwin.tar.gz
;;
Darwin-arm64)
target=aarch64-apple-darwin.tar.gz
;;
*)
echo "Unsupported platform: $platform"
exit 1
;;
esac
curl -L -o hatch.bin https://github.com/pypa/hatch/releases/download/hatch-v1.12.0/hatch-$target
mkdir -p .bin
if [ "${OS:-}" == "Windows_NT" ]; then
unzip hatch.bin
mv hatch.exe .bin
chmod +x .bin/hatch.exe
.bin/hatch.exe --version
else
tar xfz hatch.bin
mv hatch .bin
.bin/hatch --version
fi
rm hatch.bin
fi

export HATCH_PYTHON="$PYTHON_BINARY"
if [ "${OS:-}" == "Windows_NT" ]; then
.bin/hatch.exe run "$@"
else
.bin/hatch run "$@"
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mongocryptd.pid
.vscode/
.nova/
venv/
.bin
secrets-export.sh
libmongocrypt.tar.gz
libmongocrypt/
Expand Down
Loading