-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstallModule.py
More file actions
executable file
·33 lines (28 loc) · 1.03 KB
/
installModule.py
File metadata and controls
executable file
·33 lines (28 loc) · 1.03 KB
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
#!/usr/bin/env python3
#this module is to install python library or a package
import tts
import cmdExecute as ce
#to install a service or python library related query
def execute_install_query(filtered_query) :
#filtering python library query
if "python" in filtered_query :
print("Installing")
indx = filtered_query.index('library')
library_name = filtered_query[indx + 1]
#install library
cmd_output = ce.execute_cmd('pip3 install '+library_name)
if cmd_output.returncode != 0 :
tts.convert_text_n_speak("Sorry Library Not Found")
else :
tts.convert_text_n_speak("Installed " + library_name + " Library")
#installing ubuntu packages
else :
indx = filtered_query.index('install')
pckg_name = filtered_query[indx + 1]
#install library
tts.convert_text_n_speak("Please Enter Password")
cmd_output = ce.execute_cmd('sudo apt install '+pckg_name)
if cmd_output.returncode != 0 :
tts.convert_text_n_speak("Unable to install service")
else :
tts.convert_text_n_speak("Installed " + pckg_name + " Library")