This repository has been archived by the owner on Nov 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_windep.py
159 lines (120 loc) · 4 KB
/
check_windep.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from tkinter import *
from tkinter.font import Font
import os, subprocess, sys, threading, pickle
class Installation(threading.Thread):
def __init__(self, dep):
threading.Thread.__init__(self)
self.dep = dep
def run(self):
global isInstall
if self.dep == "python":
global label_pip
val = subprocess.call('pip install -r requirements.txt')
if val == 1:
label_pip['fg'] = 'red'
label_pip['text'] = 'erreur ✘'
else:
label_pip['fg'] = 'green'
label_pip['text'] = 'succes ✓'
isInstall = False
label_pip.update()
elif self.dep == "npm":
global label_npm
ls = os.popen('dir /B node_modules').read()
ls = ls.split('\n')
if "jquery" not in ls:
val = subprocess.call('npm i jquery --save ', shell=True)
if val == 0:
label_npm['fg'] = 'green'
label_npm['text'] = 'succes ✓'
else:
label_npm['fg'] = 'red'
label_npm['text'] = 'erreur ✘'
else:
label_npm['fg'] = 'green'
label_npm['text'] = 'Ok ✓'
label_npm.update()
isInstall = False
verify()
def verify():
global label_npm
global label_pip
if (label_npm['text'] == 'Ok ✓' and label_pip['text'] == 'succes ✓') or ((label_npm['text'] == 'succes ✓' and label_pip['text'] == 'succes ✓')):
Button(fen, text="Fermer", fg="teal", width=15, height=3, font = Font(size=14), command=fen.quit).pack(pady=10)
file = open('check.pickle', 'wb')
val = True
check = pickle.dump(val, file)
file.close()
def chargement():
global isInstall
global label_pip
global isMount
if isInstall:
if isMount:
if len(label_pip['text']) == 13:
isMount = False
else:
label_pip['text'] += '.'
else:
if len(label_pip['text']) == 10:
isMount = True
else:
label_pip['text'] = label_pip['text'][:-1]
label_pip.update()
fen.after(500, chargement)
def chargement_npm():
global isInstall
global label_npm
global isMount0
if isInstall:
if isMount0:
if len(label_npm['text']) == 13:
isMount0 = False
else:
label_npm['text'] += '.'
else:
if len(label_npm['text']) == 10:
isMount0 = True
else:
label_npm['text'] = label_npm['text'][:-1]
label_pip.update()
fen.after(500, chargement_npm)
def run():
global isInstall
global label_pip
install = Installation("python")
install.start()
isInstall = True
label_pip['text'] = "chargement"
label_pip.update()
chargement()
def run_npm():
global isInstall
global label_npm
install = Installation("npm")
install.start()
isInstall = True
label_npm['text'] = "chargement"
label_npm.update()
chargement_npm()
def main():
global label_pip
fen.title("Verification")
Label(fen, text = "Dependance Python", font = Font(size=14, underline=1)).pack()
Button(fen, text="Installer", width = 15, font = Font(size=12), command=run).pack(pady=15)
label_pip.pack()
Label(fen, text = "Dependance Node", font = Font(size=14, underline=1)).pack(pady=10)
Button(fen, text="Installer", width = 15, font = Font(size=12), command=run_npm).pack(pady=10)
label_npm.pack()
def __fin__():
fen.mainloop()
if __name__ == '__main__':
fen = Tk()
fen.geometry("250x300")
isInstall = False
isMount = True
isMount0 = True
label_pip = Label(fen, text="")
label_npm = Label(fen, text="")
main()
__fin__()