-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbootstrap.sh
executable file
·47 lines (39 loc) · 1.02 KB
/
bootstrap.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
#!/usr/bin/env bash
# Trivial script to create virtualenv and do initial package install for dev
# or deployment
# (Requires system pip to be available)
set -e
VENV_PATH=./venv
VIRTUALENV_OPTIONS="--system-site-packages"
# Requirements to run the django app and develop/test/deploy:
REQUIREMENTS_DEV=requirements/dev.txt
PYTHON_INTERPRETER=/usr/bin/python3
usage() {
echo "Usage: $0 [-h] [-p path]"
exit 0;
}
while getopts "h3p:" opt; do
case "${opt}" in
h)
usage
;;
p)
VENV_PATH=${OPTARG}
;;
*)
usage
;;
esac
done
if [[ ! -e ${PYTHON_INTERPRETER} && -x ${PYTHON_INTERPRETER} ]]; then
echo "Python executable '${PYTHON_INTERPRETER}' not found"
exit 1
fi
if [[ -e ${VENV_PATH} ]]; then
echo "Virtualenv '${VENV_PATH}' already exists"
exit 1
fi
virtualenv -p ${PYTHON_INTERPRETER} $VENV_PATH $VIRTUALENV_OPTIONS
source $VENV_PATH/bin/activate
pip install --upgrade pip
pip install --requirement $REQUIREMENTS_DEV