forked from sukeesh/Jarvis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·92 lines (75 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
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
#!/bin/bash
# fail on error!
set -euo pipefail
# check virtualenv exists
if ! which "virtualenv" 2>/dev/null >/dev/null; then
echo "Please install virtualenv!"
echo ""
echo "https://github.com/pypa/virtualenv"
echo ""
echo "For Example on Ubuntu you could do > [sudo] apt install virtualenv"
echo "Or use Pip: > [sudo] pip install virtualenv"
exit -1
fi
read -n 1 -p "Specify python version(2/3)(Default-3)" answer
echo ""
case ${answer:0:1} in
2 )
echo "Selected python version 2"
;;
* )
echo "Selected python version 3"
;;
esac
UNAME=$(uname -s)
jarvispath=$PWD
touch jarvis
chmod +rwx jarvis
exec 3<> jarvis
echo "#!/bin/bash" >&3
if [[ "$UNAME" == "Darwin" ]]; then
echo ". $jarvispath/env/bin/activate" >&3
case ${answer:0:1} in
2 )
echo "python $jarvispath/jarviscli/ \$*" >&3
;;
* )
echo "python3 $jarvispath/jarviscli/ \$*" >&3
;;
esac
else
echo "source $jarvispath/env/bin/activate" >&3
echo "python $jarvispath/jarviscli/ \$*" >&3
fi
exec 3>&-
case ${answer:0:1} in
2 )
virtualenv env --python=python2
python_version=py2
;;
* )
virtualenv env --python=python3
python_version=py3
;;
esac
VIRTUAL_ENV_DISABLE_PROMPT=true source env/bin/activate
# base requirements
pip install --upgrade -r requirements.txt
# wordnet
python -m nltk.downloader -d jarviscli/data/nltk wordnet
# voice control requirements
error=false
pip install --upgrade -r requirements_voice_control.txt 2> /dev/null || error=true
if $error; then
error=false
python installpyaudio.py $python_version || error=true
if $error; then
echo
echo
echo "Installation of requirements for voice control failed!"
echo "Don't worry, Jarvis will work anyway. However if you need voice control, re-run this setup."
else
pip install --upgrade -r requirements_voice_control.txt
fi
fi
sudo cp jarvis /usr/local/bin