summaryrefslogtreecommitdiffstats
path: root/bin/helpers/algo-virtualenv
blob: 531873fd79776cba7af7e41ca26cb532490c79a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
set -eu
set -o pipefail

# using tmpdir as a virtualenv because the tozt-secrets filesystem is too small
# to hold the whole python installation
envdir="$(mktemp --tmpdir -d launch-algo.XXXXXXXXXX)"
cleanup() {
    if perl -e'exit 1 unless $ARGV[0] =~ m{^/tmp/launch-algo.*$}' "$envdir"; then
        rm -rf "$envdir"
    fi
}
trap cleanup EXIT

python2 -m virtualenv --python="$(command -v python2)" "$envdir"
set +eu
# shellcheck disable=SC1090
. "$envdir"/bin/activate
set -eu

python -m pip install -U pip
python -m pip install -r /mnt/algo/algo/requirements.txt