-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.sh
66 lines (61 loc) · 1.96 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
66
#!/usr/bin/env bash
# ------------------------------------------------------------------
# [Michael J. Davis]
# setup.sh
# Easily setup python's virtualenv, install requirements.
# ------------------------------------------------------------------
{
[[ "${BASH_SOURCE[0]}" != $0 ]]
} || {
echo "
Please run script as 'source'
"
exit 1
}
# ------------------------------------------------------------------
# DESIGNATE REQUIRED PYTHON VERSION
# ------------------------------------------------------------------
PYTHON_VERSION="3.5.2"
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ------------------------------------------------------------------
# RUN SETUP
# ------------------------------------------------------------------
run_first_time_setup() {
read -r -p "${1:-Are you in the parent directory of your python project? [y/N]} " response
case ${response} in
[yY][eE][sS]|[yY])
READY=true
;;
*)
echo "Make sure this script location and current directory == project root directory"
READY=false
;;
esac
}
if [ ! -d ${THIS_DIR}/env ]
then
run_first_time_setup
if [ ${READY} = true ]
then
{
curl -O https://raw.githubusercontent.com/mijdavis2/ezpz-setup/master/ezpz-setup.sh
source ${THIS_DIR}/ezpz-setup.sh -r ${PYTHON_VERSION}
} && {
mv ${THIS_DIR}/ezpz-setup.sh ${THIS_DIR}/env/
} || {
echo "Setup failed!"
echo "Try removing THIS_DIR/env and THIS_DIR/tmp"
echo "TODO:"
echo " implement '--update' arg to download fresh copy of ezpz-setup.sh"
}
fi
else
{
source ${THIS_DIR}/env/ezpz-setup.sh -r ${PYTHON_VERSION}
} || {
echo "Setup failed!"
echo "Try removing THIS_DIR/env and THIS_DIR/tmp"
echo "TODO:"
echo " implement '--update' arg to download fresh copy of ezpz-setup.sh"
}
fi