-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
59 lines (48 loc) · 1.51 KB
/
install.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
#!bin/bash
PROGRAM=$(basename $0)
error()
{
echo -e "$@" 1>&2
exit 1
}
usage()
{
echo -e "Usage:
$PROGRAM [PATH_TO_PYTHON3]
Checks for requirements and compiles SONiCS. Performs small test to check if everything is working properly."
}
PATH_TO_PYTHON3=$1
if [ "X$PATH_TO_PYTHON3" == "X" ]; then
PATH_TO_PYTHON3=$(which python3);
fi
#check Python version
major=$("$PATH_TO_PYTHON3" --version 2>&1 | cut -f2 -d' ' | cut -f1 -d'.')
minor=$("$PATH_TO_PYTHON3" --version 2>&1 | cut -f2 -d' ' | cut -f2 -d'.')
if [[ major -lt "3" || minor -lt "4" ]]; then
error "SONiCS requires Python version 3.4 or higher."
fi
#check for all the packages
for package in $(echo "cython numpy pandas scipy"); do
if ! "$PATH_TO_PYTHON3" -c "import $package" &> /dev/null; then
missing_packages=$(echo ${missing_packages} $package);
fi
done
if [ "X$missing_packages" != "X" ]; then
error "Missing module(s): ${missing_packages}."
fi
# Compile mvhyperg code
f2py -c -m pymc_extracted pymc_extracted.f
# Cythonize SONiCS
"$PATH_TO_PYTHON3" setup.py build_ext --inplace
# run test
echo "Running test on support read out: 8|5;9|113;10|89"
"$PATH_TO_PYTHON3" sonics "8|5;9|113;10|89"
if [ $? == 0 ]; then
echo "Everything seems to be working all right."
echo "The output of the test is in sonics_out.txt"
rm -rf build
else
echo "The installation did not work as expected. Please check the error"
echo "messages above to resolve installation issues. Please contact the"
echo "author if you need further help. "
fi