-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·65 lines (55 loc) · 2.15 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import subprocess
import sys
import platform
import time
import parameters as gl
def get_system_info(show=False):
os_name = platform.system()
os_version = platform.version()
hostname = platform.node()
architecture = platform.architecture()
python_version = platform.python_version()
gl.RUN_FROM = os.path.dirname(os.path.abspath(__file__))
# Print the information
if show:
print('{:>18}'.format("Operating System:"), os_name)
print('{:>18}'.format(" OS Version:"), os_version)
print('{:>18}'.format(" Hostname:"), hostname)
print('{:>18}'.format(" Architecture:"), architecture[0] , architecture[1])
print('{:>18}'.format(" Python Version:"), python_version)
print('{:>18}'.format(" Run From:"), gl.RUN_FROM)
if os_name == 'Windows':
import ctypes
gl.DOCUMENTS_DIR = os.path.expanduser('~\\Documents')
# print('{:>18}'.format('Documentos:'), gl.DOCUMENTS_DIR)
user32 = ctypes.windll.user32
SM_CXSCREEN = 0
SM_CYSCREEN = 1
# Retrieve screen resolution
gl.SCREEN_WIDTH = user32.GetSystemMetrics(SM_CXSCREEN)
gl.SCREEN_HEIGHT = user32.GetSystemMetrics(SM_CYSCREEN)
# print('{:>18}'.format('W Screen:'), gl.SCREEN_WIDTH)
# print('{:>18}'.format('H Screen:'), gl.SCREEN_HEIGHT)
def install_dependencies(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
def main():
get_system_info()
try:
from PyQt5.QtWidgets import QDesktopWidget
run_main = lambda: os.system('python.exe main.py')
run_main ()
exit()
except (ImportError, ModuleNotFoundError):
clear = lambda: os.system('cls')
clear()
pip_update = lambda: os.system('python.exe -m pip install --upgrade pip')
pip_update()
install_dependencies('pyqt5')
install_dependencies('pyqtwebengine')
time.sleep(1)
run_main = lambda: os.system('python.exe main.py')
run_main ()
exit(0)
if __name__ == '__main__':
main()