forked from mongodb/mongo-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mongodb/mongo-python-driver
- Loading branch information
Showing
15 changed files
with
127 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,5 @@ | ||
#!/bin/bash | ||
set -o errexit # Exit the script with error if any of the commands fail | ||
set -x | ||
set -eu | ||
|
||
. .evergreen/utils.sh | ||
|
||
if [ -z "$PYTHON_BINARY" ]; then | ||
PYTHON_BINARY=$(find_python3) | ||
fi | ||
|
||
# Check if we should skip hatch and run the tests directly. | ||
if [ -n "$SKIP_HATCH" ]; then | ||
ENV_NAME=testenv-$RANDOM | ||
createvirtualenv "$PYTHON_BINARY" $ENV_NAME | ||
# shellcheck disable=SC2064 | ||
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP | ||
python -m pip install -e ".[test]" | ||
run_hatch() { | ||
bash ./.evergreen/run-tests.sh | ||
} | ||
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 | ||
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin | ||
HATCH_CONFIG=$(cygpath -m "$HATCH_CONFIG") | ||
fi | ||
export HATCH_CONFIG | ||
hatch config restore | ||
hatch config set dirs.data "$(pwd)/.hatch/data" | ||
hatch config set dirs.cache "$(pwd)/.hatch/cache" | ||
|
||
run_hatch() { | ||
python -m hatch run "$@" | ||
} | ||
fi | ||
|
||
run_hatch "${@:1}" | ||
. .evergreen/scripts/ensure-hatch.sh | ||
hatch run "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
# Ensure hatch is available. | ||
if [ ! -x "$(command -v hatch)" ]; then | ||
# Install a virtual env with "hatch" | ||
# Ensure there is a python venv. | ||
. .evergreen/utils.sh | ||
|
||
if [ -z "${PYTHON_BINARY:-}" ]; then | ||
PYTHON_BINARY=$(find_python3) | ||
fi | ||
VENV_DIR=.venv | ||
if [ ! -d $VENV_DIR ]; then | ||
echo "Creating virtual environment..." | ||
createvirtualenv "$PYTHON_BINARY" .venv | ||
echo "Creating virtual environment... done." | ||
fi | ||
if [ -f $VENV_DIR/Scripts/activate ]; then | ||
. $VENV_DIR/Scripts/activate | ||
else | ||
. $VENV_DIR/bin/activate | ||
fi | ||
|
||
python --version | ||
|
||
echo "Installing hatch..." | ||
python -m pip install -U pip | ||
python -m pip install hatch || { | ||
# Install rust and try again. | ||
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 | ||
export RUSTUP_HOME="${CARGO_HOME}/.rustup" | ||
${DRIVERS_TOOLS}/.evergreen/install-rust.sh | ||
source "${CARGO_HOME}/env" | ||
python -m pip install hatch | ||
} | ||
# Ensure hatch does not write to user or global locations. | ||
touch hatch_config.toml | ||
HATCH_CONFIG=$(pwd)/hatch_config.toml | ||
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin | ||
HATCH_CONFIG=$(cygpath -m "$HATCH_CONFIG") | ||
fi | ||
export HATCH_CONFIG | ||
hatch config restore | ||
hatch config set dirs.data "$(pwd)/.hatch/data" | ||
hatch config set dirs.cache "$(pwd)/.hatch/cache" | ||
|
||
echo "Installing hatch... done." | ||
fi | ||
hatch --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters