-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·65 lines (55 loc) · 1.71 KB
/
setup.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
64
65
#!/bin/bash
###############################################################################
SCRIPT_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ;
###############################################################################
function setup_env () {
if [ $VIRTUAL_ENV ] ; then
exit 0
else
if $(hash git) ; then
git submodule update --init
fi
if [ $PY3 ] ; then
virtualenv . --prompt="[$1] " --python=/usr/bin/python3 --system-site-packages
elif [ $PY2 ] ; then
virtualenv . --prompt="[$1] " --python=/usr/bin/python2 --system-site-packages
else
virtualenv . --prompt="[$1] " --python=/usr/bin/python --system-site-packages
fi
fi
}
function pip_update () {
if [ ${VIRTUAL_ENV} ] ; then
for LIB in $(pip list | cut -d' ' -f1) ; do
pip install --upgrade $LIB
done
fi
}
function clean_env () {
rm -rf bin/ include/ lib/ share/
}
function clean_egg () {
rm -rf build/ dist/ *.egg-info/
}
function clean_pyc () {
rm -rf $(tree -fi | grep __pycache__$)
rm -rf $(tree -fi | grep \\.pyc$)
}
function clean_log () {
rm -rf $(tree -fi | grep \\.log$)
}
###############################################################################
###############################################################################
case ${1} in
clean)
clean_env && clean_egg && clean_pyc && clean_log ;;
init)
setup_env "avalanche" ;;
pip-update)
pip_update ;;
*)
$0 init $1 $2 ;;
esac
###############################################################################
###############################################################################
exit 0