summaryrefslogtreecommitdiff
path: root/evergreen/prelude.sh
diff options
context:
space:
mode:
authorRichard Samuels <richard.l.samuels@gmail.com>2021-04-28 10:43:44 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-28 15:17:48 +0000
commitaf417a7391c41eab6a6dec0c600c45ed7158d9d1 (patch)
tree56b51c04490f58d113a5617ae037fcc7d4f25fe8 /evergreen/prelude.sh
parent0b4314a71f454051694af2a1f7a3e3b60b2175ee (diff)
downloadmongo-af417a7391c41eab6a6dec0c600c45ed7158d9d1.tar.gz
Revert "SERVER-55626 Extract shell scripts from server yaml part 3"
This reverts commit 2422c8e26ed3562f6b390901c37ec903fe6d941c.
Diffstat (limited to 'evergreen/prelude.sh')
-rwxr-xr-xevergreen/prelude.sh29
1 files changed, 27 insertions, 2 deletions
diff --git a/evergreen/prelude.sh b/evergreen/prelude.sh
index 86f41a53c44..823b29449af 100755
--- a/evergreen/prelude.sh
+++ b/evergreen/prelude.sh
@@ -16,8 +16,33 @@ if [ "$PWD" != "$calculated_workdir" ]; then
exit 1
fi
-. "$evergreen_dir/prelude_python.sh"
-. "$evergreen_dir/prelude_venv.sh"
+function activate_venv {
+ set -e
+ # check if virtualenv is set up
+ if [ -d "${workdir}/venv" ]; then
+ if [ "Windows_NT" = "$OS" ]; then
+ # Need to quote the path on Windows to preserve the separator.
+ . "${workdir}/venv/Scripts/activate" 2>/tmp/activate_error.log
+ else
+ . ${workdir}/venv/bin/activate 2>/tmp/activate_error.log
+ fi
+ if [ $? -ne 0 ]; then
+ echo "Failed to activate virtualenv: $(cat /tmp/activate_error.log)"
+ fi
+ python=python
+ else
+ python=${python:-/opt/mongodbtoolchain/v3/bin/python3}
+ fi
+
+ if [ "Windows_NT" = "$OS" ]; then
+ export PYTHONPATH="$PYTHONPATH;$(cygpath -w ${workdir}/src)"
+ else
+ export PYTHONPATH="$PYTHONPATH:${workdir}/src"
+ fi
+
+ echo "python set to $(which $python)"
+ set +e
+}
expansions_yaml="$evergreen_dir/../../expansions.yml"
expansions_default_yaml="$evergreen_dir/../etc/expansions.default.yml"