mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
# exit immediately if virtualenv is not found
|
|
set -o errexit
|
|
|
|
evergreen_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
. "$evergreen_dir/../prelude_python.sh"
|
|
|
|
python_loc=$(which ${python:-/opt/mongodbtoolchain/v3/bin/python3})
|
|
venv_dir="${workdir}/venv"
|
|
if [ -d "$venv_dir" ]; then
|
|
exit 0
|
|
fi
|
|
"$python_loc" -m venv "$venv_dir"
|
|
|
|
# venv creates its Scripts/activate file with CLRF endings, which
|
|
# cygwin bash does not like. dos2unix it
|
|
# (See https://bugs.python.org/issue32451)
|
|
if [ "Windows_NT" = "$OS" ]; then
|
|
dos2unix "${workdir}/venv/Scripts/activate"
|
|
fi
|
|
|
|
export VIRTUAL_ENV_DISABLE_PROMPT=yes
|
|
|
|
# Not all git get project calls clone into ${workdir}/src so we allow
|
|
# callers to tell us where the pip requirements files are.
|
|
pip_dir="${pip_dir}"
|
|
if [[ -z $pip_dir ]]; then
|
|
# Default to most common location
|
|
pip_dir="${workdir}/src/etc/pip"
|
|
fi
|
|
|
|
# Same as above we have to use quotes to preserve the
|
|
# Windows path separator
|
|
toolchain_txt="$pip_dir/toolchain-requirements.txt"
|
|
|
|
# the whole prelude cannot be imported because it requires pyyaml to be
|
|
# installed, which happens just below.
|
|
. "$evergreen_dir/../prelude_venv.sh"
|
|
|
|
activate_venv
|
|
echo "Upgrading pip to 21.0.1"
|
|
python -m pip install "pip==21.0.1"
|
|
python -m pip install -r "$toolchain_txt" -q
|
|
python -m pip freeze >pip-requirements.txt
|