Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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
55 changes: 37 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,40 @@ 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

# Bootstrap hatch if needed.
if ! command -v hatch > /dev/null ; then
platform="$(uname -s)-$(uname -m)"
case $platform in
Linux-x86_64)
target=x86_64-unknown-linux-gnu
;;
Linux-aarch64)
target=aarch64-unknown-linux-gnu
;;
CYGWIN_NT*)
target=x86_64-pc-windows-msvc
;;
Darwin-x86_64)
target=x86_64-apple-darwin
;;
Darwin-arm64)
target=aarch64-apple-darwin
;;
*)
echo "Unsupported platform: $platform"
exit 1
;;
esac
curl -L -o hatch.tgz https://github.com/pypa/hatch/releases/download/hatch-v1.12.0/hatch-$target.tar.gz
tar xfz hatch.tgz
rm hatch.tgz
mkdir -p .bin
mv hatch .bin/
hatch --version
fi

run_hatch "${@:1}"
HATCH_PYTHON="$PYTHON_BINARY" hatch run "$@"
2 changes: 1 addition & 1 deletion .evergreen/scripts/configure-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export MONGODB_BINARIES="$MONGODB_BINARIES"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"

export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
export PATH="$MONGODB_BINARIES:$PATH"
export PATH="$PROJECT_DIRECTORY/.bin:$MONGODB_BINARIES:$PATH"
# shellcheck disable=SC2154
export PROJECT="$project"
export PIP_QUIET=1
Expand Down
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