-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·84 lines (74 loc) · 2.3 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# Initial setup for running k-NN calculation
#
# Downloads dependencies as needed
if [ ! -d dependencies ]; then
mkdir dependencies
fi
#######################################################
### Dependencies/Python configuration #################
PYCONFIG=dependencies/pyconfig.sh
if [ -e ${PYCONFIG} ]; then
echo "Python configuration file ${PYCONFIG} exists."
echo "Running git pull on dependencies..."
if [ -d dependencies/pyemblib ]; then
cd dependencies/pyemblib
git pull
cd ../../
fi
if [ -d dependencies/configlogger ]; then
cd dependencies/configlogger
git pull
cd ../../
fi
if [ -d dependencies/miscutils ]; then
cd dependencies/miscutils
git pull
cd ../../
fi
source ${PYCONFIG}
else
# start Python configuration file
echo '#!/bin/bash' > ${PYCONFIG}
# configure Python installation to use
echo "Python environment to execute with (should include tensorflow)"
read -p "Path to binary [default: python3]: " PY
if [ -z "${PY}" ]; then
PY=python3
fi
echo "export PY=${PY}" >> ${PYCONFIG}
# check for pyemblib
${PY} -c "import pyemblib" 2>>/dev/null
if [[ $? = 1 ]]; then
echo
echo "Cloning pyemblib..."
cd dependencies
git clone https://github.com/drgriffis/pyemblib.git
cd ../
echo "export PYTHONPATH=\${PYTHONPATH}:$(pwd)/dependencies/pyemblib" >> ${PYCONFIG}
fi
# check for configlogger
${PY} -c "import configlogger" 2>>/dev/null
if [[ $? = 1 ]]; then
echo
echo "Cloning configlogger"
cd dependencies
git clone https://github.com/drgriffis/configlogger.git
cd ../
echo "export PYTHONPATH=\${PYTHONPATH}:$(pwd)/dependencies/configlogger" >> ${PYCONFIG}
fi
# check for drgriffis.common
${PY} -c "import drgriffis.common" 2>>/dev/null
if [[ $? = 1 ]]; then
echo
echo "Cloning miscutils (drgriffis.common)"
cd dependencies
git clone https://github.com/drgriffis/miscutils.git
cd ../
echo "export PYTHONPATH=\${PYTHONPATH}:$(pwd)/dependencies/miscutils/py" >> ${PYCONFIG}
fi
echo
echo "Python configuration complete."
echo "Configuration written to ${PYCONFIG}"
fi