-
Notifications
You must be signed in to change notification settings - Fork 80
/
setup-virtualenv.sh
executable file
·86 lines (65 loc) · 1.76 KB
/
setup-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
VERSION=1.9.1
VIRTUALENV="virtualenv-${VERSION}.tar.gz"
read -r -d '' HELP <<EOF
Usage: setup-virtualenv.sh [options]
Setup a local python environment with virtualenv, and install all
DataMill dependencies. Optionally install only the dependencies with
the existing virtualenv.
Options:
-h,--help Print this help documentation.
-d,--only-deps Only install dependencies, not virtualenv.
EOF
# Execute getopt
ARGS=`getopt -o "dh" -l "only-deps,help" \
-n "setup-virtualenv.sh" -- "$@"`
#Bad arguments
if [ $? -ne 0 ];
then
exit 1
fi
eval set -- "$ARGS"
while true;
do
case "$1" in
-h|--help)
echo "$HELP"
exit 0
shift;;
-d|--only-deps)
echo "Only installing deps, assuming working virtualenv"
ONLYDEPS=true
shift;;
--)
shift
break;;
esac
done
# Non PYPI install functions
function install_cloud_ide() {
git clone git://github.com/yuguang/django-cloud-ide.git
pushd django-cloud-ide > /dev/null
../dev-python/bin/python setup.py install
popd > /dev/null
rm -rf django-cloud-ide
}
# Install Virtualenv in local directory
if [ -z "$ONLYDEPS" ]; then
echo "Installing virtualenv in $(pwd)"
curl -O https://pypi.python.org/packages/source/v/virtualenv/"$VIRTUALENV"
tar xavf "$VIRTUALENV"
pushd "${VIRTUALENV%%.tar.gz}" > /dev/null
python2 virtualenv.py --no-site-packages ../dev-python
popd > /dev/null
rm -r "${VIRTUALENV%%.tar.gz}"
rm "${VIRTUALENV}"
fi
# Install all pypi dependencies
echo "Installing PYPI packages"
if ! dev-python/bin/pip install -r requirements.txt; then
echo "Pip command failed." 1>&2
exit 1
fi
# Install dependencies not in pypi
echo "Installing packages not in PYPI"
install_cloud_ide;