-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello
executable file
·106 lines (85 loc) · 3.84 KB
/
hello
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env bash
CLR_NOR="\x1b[0m" # back to NORMAL
CLR_BOLD="\x1b[1m" # BOLD text
CLR_RED="\x1b[31m" # RED text
CLR_GRN="\x1b[32m" # GREEN text
CLR_YLW="\x1b[33m" # YELLOW text
export PRJ_HOME=`pwd`
echo -e "${CLR_YLW}Checking Python version......${CLR_NOR}"
PYV=`python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
if [[ $PYV == 2.7 ]]
then
PY=python3;
PIP=pip3;
PIP_INST="pip3 install -i https://pypi.douban.com/simple/";
NTB="ipython3 notebook";
TEST="nosetests"
fi
if [[ $PYV == 3* ]]
then
PY=python;
PIP=pip;
PIP_INST="pip3 install -i https://pypi.douban.com/simple/";
NTB="jupyter notebook";
TEST="nosetests"
fi
if (eval "${PY} -V"); then
echo -e "${CLR_YLW}Python version checked......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
else
echo -e "${CLR_YLW}Python version checked......${CLR_NOR}${CLR_RED}Failed${CLR_NOR}"
exit -1
fi
echo -e "${CLR_YLW}Setting Python path to user local......${CLR_NOR}${CLR_GRN}Done${CLR_NOR}"
export PYTHONPATH=$PRJ_HOME/.py/lib/$PY/site-packages/:$PRJ_HOME/src:$PRJ_HOME/test
if (eval "$PY -c 'import virtualenv as venv'"); then
echo -e "${CLR_YLW}Checking virtualenv......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
else
echo -e "${CLR_YLW}Checking virtualenv......${CLR_NOR}${CLR_RED}Failed${CLR_NOR}"
echo -e "${CLR_YLW}Reinstalling virtualenv......${CLR_NOR}"
eval "${PIP} uninstall virtualenv"
eval "${PIP_INST} virtualenv"
echo -e "${CLR_YLW}Reinstalling virtualenv......${CLR_NOR}${CLR_GRN}Done${CLR_NOR}"
fi
if (eval "${PY} bin/env.py"); then
source .py/bin/activate
echo -e "${CLR_YLW}Installing numpy......${CLR_NOR}"
eval "${PIP_INST} numpy"
echo -e "${CLR_YLW}Installing numpy......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing scipy......${CLR_NOR}"
eval "${PIP_INST} scipy"
echo -e "${CLR_YLW}Installing scipy......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing Pillow......${CLR_NOR}"
eval "${PIP_INST} Pillow"
echo -e "${CLR_YLW}Installing Pillow......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing matplotlib......${CLR_NOR}"
eval "${PIP_INST} matplotlib"
echo -e "${CLR_YLW}Installing matplotlib......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing pyzmq......${CLR_NOR}"
eval "${PIP_INST} pyzmq"
echo -e "${CLR_YLW}Installing pyzmq......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing jinja2......${CLR_NOR}"
eval "${PIP_INST} jinja2"
echo -e "${CLR_YLW}Installing jinja2......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing tornado......${CLR_NOR}"
eval "${PIP_INST} tornado"
echo -e "${CLR_YLW}Installing tornado......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing jsonschema......${CLR_NOR}"
eval "${PIP_INST} jsonschema"
echo -e "${CLR_YLW}Installing jsonschema......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing terminado......${CLR_NOR}"
eval "${PIP_INST} terminado"
echo -e "${CLR_YLW}Installing terminado......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing ipython......${CLR_NOR}"
eval "${PIP_INST} ipython"
echo -e "${CLR_YLW}Installing ipython......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing nose......${CLR_NOR}"
eval "${PIP_INST} nose"
echo -e "${CLR_YLW}Installing nose......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing jupyter......${CLR_NOR}"
eval "${PIP_INST} jupyter"
echo -e "${CLR_YLW}Installing jupyter......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
echo -e "${CLR_YLW}Installing dependencies......${CLR_NOR}"
eval "${PIP_INST} -r requirements.txt"
echo -e "${CLR_YLW}Installing dependencies......${CLR_NOR}${CLR_GRN}OK${CLR_NOR}"
export PATH="$PATH:${PRJ_HOME}/bin/"
fi