forked from GobTrans/gobtrans-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
27 lines (22 loc) · 732 Bytes
/
dev.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
# Check for pip
if ! which pip >/dev/null; then
echo "Please install pip. 'easy_install pip' usually works."
return
fi
need_pkg() {
if ! pip freeze 2>/dev/null | grep -q "^$1=="; then
echo "Package $1 not installed. Try 'pip install $1'."
return
fi
}
# Check if virtualenvwrapper is installed
need_pkg virtualenvwrapper
. `which virtualenvwrapper.sh`
PROJ_DIR=`dirname \`readlink -f "$BASH_SOURCE"\``
PROJ_NAME=`basename $PROJ_DIR`
[ -f "$PROJ_DIR"/deploy/requirements.txt ] && MKENV_OPTS="$MKENV_OPTS -r $PROJ_DIR/deploy/requirements.txt"
if lsvirtualenv | grep -q "^$PROJ_NAME$"; then
workon "$PROJ_NAME"
else
mkvirtualenv -a "$PROJ_DIR" $MKENV_OPTS --no-site-packages "$PROJ_NAME"
fi