-
Notifications
You must be signed in to change notification settings - Fork 0
/
startenv.sh
63 lines (52 loc) · 1.76 KB
/
startenv.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
BASESCRIPT=$(readlink -f "$0")
BASE=$(dirname "$BASESCRIPT")
PROJ="cse231"
if [ -n "${VTENV}" ]; then
if [ "${BASE}" = "${VTENV}" -a "${PROJ}" = "${VTENV_NAME}" ]; then
echo "${VTENV_NAME} Virtual Environment is already active."
else
echo "There is already ${VTENV_NAME} Virtual Environment activated."
echo "(at ${VTENV})"
echo "Deactivate it first (using command 'deactivate_vtenv'), to activate"
echo "test environment."
fi
return 1
fi
export VTENV="${BASE}"
export VTENV_NAME="${PROJ}"
export CSE231ROOT="${VTENV}"
export LLVMBIN="${VTENV}/llvm/build/Release+Asserts/bin"
export LLVMLIB="${VTENV}/llvm/build/Release+Asserts/lib"
export BENCHMARKS="${VTENV}/extra/benchmarks"
export INSTRUMENTATION="${VTENV}/extra/instrumentation"
export OUTPUTLOGS="${VTENV}/logs"
echo "Activating ${VTENV_NAME} Virtual Environment (at ${VTENV})."
echo ""
echo "To exit from this virtual environment, enter command 'deactivate_vtenv'."
export "VTENV_PATH_BACKUP"="${PATH}"
export "VTENV_PS1_BACKUP"="${PS1}"
deactivate_vtenv() {
echo "Deactivating ${VTENV_NAME} Virtual Environment (at ${VTENV})."
echo "Restoring previous environment settings."
export "PATH"="${VTENV_PATH_BACKUP}"
unset -v "VTENV_PATH_BACKUP"
export "PS1"="${VTENV_PS1_BACKUP}"
unset -v "VTENV_PS1_BACKUP"
unset -v VTENV
unset -v VTENV_NAME
unset -v CSE231ROOT
unset -v LLVMBIN
unset -v LLVMLIB
unset -v BENCHMARKS
unset -v INSTRUMENTATION
unset -v OUTPUTLOGS
unset -f deactivate_vtenv
if [ -n "$BASH" -o -n "$ZSH_VERSION" ]; then
hash -r
fi
}
export PATH="${VTENV}/llvm/build/Release+Asserts/bin:${PATH}"
export PS1="[${VTENV_NAME}]${PS1}"
if [ -n "$BASH" -o -n "$ZSH_VERSION" ]; then
hash -r
fi