-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_init.sh
executable file
·110 lines (96 loc) · 2.19 KB
/
dev_init.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
function check_executable()
{
echo "Checking $EXEC..."
if [ ! -x "/usr/bin/$EXEC" ]
then
AVAILABLE=false
if [ "$REQUIRED" = "true" ]
then
echo
echo "$EXEC executable not present!"
echo "Install on Debian systems with:"
echo "sudo apt-get install $EXEC $ADDITIONAL"
echo
exit 1
else
echo "...NOT present"
fi
else
echo "...is present"
AVAILABLE=true
fi
}
function check_repository()
{
echo "Checking repo $REPO..."
if [ ! -d "../$REPO" ]
then
echo
echo "Directory ../$REPO does not exist!"
echo "Check out repo as follows:"
echo "cd .."
echo "git clone https://github.com/waikato-ufdl/$REPO.git"
echo
exit 2
else
echo "...is present"
fi
}
echo "Performing checks"
EXEC="virtualenv"
ADDITIONAL=""
REQUIRED=true
check_executable
EXEC="python3.7"
ADDITIONAL="python3.7-dev"
REQUIRED=false
check_executable
PYTHON37_AVAILABLE=$AVAILABLE
EXEC="python3.8"
ADDITIONAL="python3.8-dev"
REQUIRED=false
check_executable
PYTHON38_AVAILABLE=$AVAILABLE
if [ "$PYTHON37_AVAILABLE" = "false" ] && [ "$PYTHON38_AVAILABLE" = "false" ]
then
echo
echo "Neither Python 3.7 nor Python3.8 are available!"
echo "Install on Debian systems with:"
echo " sudo apt-get install python3.7 python3.7-dev"
echo "or"
echo " sudo apt-get install python3.8 python3.8-dev"
echo
exit 1
fi
if [ "$PYTHON37_AVAILABLE" = "true" ]
then
PYTHON=python3.7
elif [ "$PYTHON38_AVAILABLE" = "true" ]
then
PYTHON=python3.8
else
echo "Don't know what Python executable to use!"
exit 2
fi
REPO="ufdl-json-messages"
check_repository
echo
echo "Press any key to start setup of 'venv' for UFDL python client (using $PYTHON)..."
read -s -n 1 key
# delete old directory
if [ -d "./venv" ]
then
echo "Removing old virtual environment..."
rm -rf ./venv
fi
echo "Creating new virtual environment..."
virtualenv -p /usr/bin/$PYTHON ./venv
echo "Installing dependencies..."
./venv/bin/pip install --upgrade pip
./venv/bin/pip install --upgrade setuptools
./venv/bin/pip install Cython
./venv/bin/pip install numpy
./venv/bin/pip install tensorflow
./venv/bin/pip install ../ufdl-json-messages
./venv/bin/pip install .