-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
48 lines (35 loc) · 1.33 KB
/
setup.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
import sys
import subprocess
import os
# importing urllib.requests for internet cheking funtions
import urllib.request
# To check if the system is connected to the internet
def connect(host="https://google.com/"):
try:
urllib.request.urlopen(host)
return True
# trying to catch exception when internet is not ON.
except:
return False
package_q = ["pycryptodomex"]
def setup_a(module_name):
# updating pip to latest version
subprocess.run("python -m pip install --upgrade pip")
# commanding terminal to pip install required modules
p = subprocess.run("python3 -m pip3 install " + module_name)
# Not connected to the internet
if p.returncode == 1 and connect() == False:
print("Error!! occured check\nInternet Conection.")
# Every thing worked fine
elif p.returncode == 0:
print(module_name, " is installed successfully.")
# Name of module is wrong
elif p.returncode == 1 and connect() == True:
print("Error!! occured check\nModule Name.")
print("Installing")
print("Please wait....")
print("Do not close this program")
for package in package_q: # sending module names to the setup_a funtion
setup_a(package)
print("Installation finished")
subprocess.run("python3 EncrypC.py") # to run the main file