-
Notifications
You must be signed in to change notification settings - Fork 21
/
install-virtualenv.sh
executable file
·50 lines (37 loc) · 1.12 KB
/
install-virtualenv.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
#!/bin/bash
# install-virtualenv.sh
#
# Install virtualenv environment for sikteeri development
# to "env/" if it doesn't exist already
VIRTUALENV=${1-virtualenv}
ENVDIR=env
if [[ ! -x "$VIRTUALENV" ]]; then
VIRTUALENV=`which $VIRTUALENV`
fi
if [[ ! -x "$VIRTUALENV" ]]; then
echo "Please install virtualenv first."
echo
echo " sudo apt-get install python-virtualenv (Debian/Ubuntu)"
echo " sudo easy_install virtualenv (OS X, others?)"
echo
echo "If you have installed it already, try running"
echo
echo "$(basename $0) <path-to-virtualenv>"
exit 1
fi
function fatal () {
echo $*
exit 1
}
test -a $ENVDIR && fatal "$ENVDIR already exists"
$VIRTUALENV $ENVDIR --no-site-packages || fatal "Failed to create virtualenv $ENVDIR"
source $ENVDIR/bin/activate
if [[ ! -a $ENVDIR/bin/pip ]]; then
$ENVDIR/bin/easy_install pip || fatal "Could not install pip in virtualenv"
fi
pip install -r requirements.txt
echo "export PYTHONPATH=.." >> $ENVDIR/bin/activate
echo "Virtualenv environment $ENVDIR done"
echo "To later activate the environment, type"
echo " . env/bin/activate"
exit 0