-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall_dependencies.py
65 lines (56 loc) · 2.47 KB
/
install_dependencies.py
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
import platform
import subprocess
"""
This is a standalone script that installs the required dependencies to run. It
*should* be platform independent, and should work regardless of what platform
you are running it on.
To install dependencies, download the DevAssist source and run this script by
running "python install_dependencies.py"
"""
# Identifying host platform
host_platform = platform.system()
def install_dependencies():
"""
Installs dependencies for DevAssist
"""
# Darwin = Mac OSX
if host_platform == "Darwin":
# Installing portaudio
# @TODO: Rewrite to not use shell=True
print("Installing portaudio...\n")
portaudio = subprocess.Popen(["brew install portaudio"], shell=True)
portaudio.communicate()
print("\nportaudio has been installed...")
# Installing pyaudio
# @TODO: Rewrite to not use shell=True
print("Installing pyaudio...\n")
pyaudio = subprocess.Popen(["pip install pyaudio"], shell=True)
pyaudio.communicate()
print("\npyaudio has been installed...")
# Installing pocketsphinx
# @TODO: Rewrite to not use shell=True
print("Installing pocketsphinx...\n")
pocketsphinx = subprocess.Popen(["pip install pocketsphinx"], shell=True)
pocketsphinx.communicate()
print("\nFinished installing pocketsphinx...")
elif host_platform == "Linux":
# Installing dependencies for portaudio
# @TODO: Rewrite to not use shell=True
print("Installing portaudio & dependencies...\n")
portaudio = subprocess.Popen(["apt-get install portaudio19-dev python-all-dev python3-all-dev"], shell=True)
portaudio.communicate()
print("\nportaudio & dependencies have been installed...")
# Installing pyaudio
# @TODO: Rewrite to not use shell=True
print("Installing pyaudio...\n")
pyaudio = subprocess.Popen(["pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio"], shell=True)
pyaudio.communicate()
print("\npyaudio has been installed...")
# Installing pocketsphinx
# @TODO: Rewrite to not use shell=True
print("Installing pocketsphinx...\n")
pocketsphinx = subprocess.Popen(["pip install pocketsphinx"], shell=True)
pocketsphinx.communicate()
print("\nFinished installing pocketsphinx...")
if __name__ == "__main__":
install_dependencies()