Skip to content

Commit d91393b

Browse files
authored
PYTHON-4644 Use a random name for hatchenv (mongodb#1782)
1 parent 8939ea3 commit d91393b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.evergreen/hatch.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ if $PYTHON_BINARY -m hatch --version; then
1313
$PYTHON_BINARY -m hatch run "$@"
1414
}
1515
else # No toolchain hatch present, set up virtualenv before installing hatch
16-
createvirtualenv "$PYTHON_BINARY" hatchenv
17-
trap "deactivate; rm -rf hatchenv" EXIT HUP
16+
# Use a random venv name because the encryption tasks run this script multiple times in the same run.
17+
ENV_NAME=hatchenv-$RANDOM
18+
createvirtualenv "$PYTHON_BINARY" $ENV_NAME
19+
# shellcheck disable=SC2064
20+
trap "deactivate; rm -rf $ENV_NAME" EXIT HUP
1821
python -m pip install -q hatch
1922
run_hatch() {
2023
python -m hatch run "$@"

.evergreen/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ find_python3() {
4343
createvirtualenv () {
4444
PYTHON=$1
4545
VENVPATH=$2
46-
rm -rf $VENVPATH
46+
4747
# Prefer venv
4848
VENV="$PYTHON -m venv"
4949
if [ "$(uname -s)" = "Darwin" ]; then

0 commit comments

Comments
 (0)