-
Notifications
You must be signed in to change notification settings - Fork 0
/
StartGui.py
62 lines (55 loc) · 1.82 KB
/
StartGui.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
import platform
import os
import sys
from shutil import which
from subprocess import call
import Core.LinuxStartUp as Start
if sys.version_info[:2] < (3, 7):
print("Requires Python 3.7 or newer. "
"Python %d.%d detected" % sys.version_info[:2])
sys.exit(-1)
if platform.system() == 'Windows':
OS = 'Windows'
elif platform.system() == 'Linux':
OS = 'Linux'
elif platform.system() == 'Darwin':
OS = 'Darwin'
path = os.getcwd()
if OS == 'Windows':
cache = path + '\Core\Cache'
elif OS == 'Darwin':
cache = path + '/Core/Cache'
else: # Linux
cache = path + '/Core/Cache'
isExist = os.path.exists(cache)
if not isExist: # Create a new directory because it does not exist
os.system('pip install -r requirements.txt')
os.system('pip install latex')
if OS == 'Windows':
if which('latex'):
print('latex installed')
else:
print('Please install Latex before using the software')
sys.exit(-1)
elif OS == 'Darwin':
if which('latex'):
print('latex installed')
else:
os.system(
'/bin / bash - c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
os.system('brew install mactex')
else: # Linux
pwd = Start.Linux()
cmd = 'sudo apt install -y idle3 texlive-latex-extra cm-super dvipng'
return_call = call('echo {} | sudo -S {}'.format(pwd, cmd), shell=True)
while return_call == 1:
pwd = Start.Linux()
cmd = 'sudo apt install -y idle3 texlive-latex-extra cm-super dvipng'
return_call = call('echo {} | sudo -S {}'.format(pwd, cmd), shell=True)
os.makedirs(cache)
if OS == 'Windows':
import Core.GUI
elif OS == 'Darwin':
import Core.GUI
else: # Linux
import Core.GUI