summaryrefslogtreecommitdiffstats
path: root/bin/helpers/algo-virtualenv
diff options
context:
space:
mode:
Diffstat (limited to 'bin/helpers/algo-virtualenv')
-rwxr-xr-xbin/helpers/algo-virtualenv22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/helpers/algo-virtualenv b/bin/helpers/algo-virtualenv
new file mode 100755
index 0000000..531873f
--- /dev/null
+++ b/bin/helpers/algo-virtualenv
@@ -0,0 +1,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