-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun_vmtool.sh
More file actions
executable file
·41 lines (31 loc) · 866 Bytes
/
Copy pathrun_vmtool.sh
File metadata and controls
executable file
·41 lines (31 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/sh
# run vmtool in automatically generated virtualenv
CURVER=12
PYTHON=python3
script="$0"
top=$(python3 -c "from os.path import realpath, dirname; print(dirname(realpath('${script}')))")
venv="$HOME/.vmtool-venv"
ver="$venv/ver.txt"
unset LC_ALL LC_TIME LC_MONETARY LC_ADDRESS LC_TELEPHONE LC_NAME
unset LC_MEASUREMENT LC_IDENTIFICATION LC_NUMERIC LC_PAPER
unset LANGUAGE LANG
set -e
refresh=1
if test -f "$ver"; then
OLDVER=`cat $ver`
if test "$CURVER" = "$OLDVER"; then
refresh=0
fi
fi
if test "$refresh" = "1"; then
echo "Rebuilding virtualenv based on requirements.txt..."
rm -rf "$venv"
$PYTHON -m venv "$venv"
"$venv"/bin/pip \
--quiet \
--disable-pip-version-check \
install -r "$top/requirements.txt"
echo "$CURVER" > "$ver"
fi
PYTHONPATH="${top}:${PYTHONPATH}" \
exec "$venv"/bin/python -m vmtool.run "$@"