forked from axceria/psgcompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
psgcompiler.pyw
304 lines (275 loc) · 19.9 KB
/
psgcompiler.pyw
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
import PySimpleGUI as sg
from threading import Thread
import sys, os, shutil
import PyInstaller
import webbrowser
version = '1.6.1'
__version__ = version.split()[0]
PYINSTALLER_HELP_URL = r'https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html'
'''
Make a "Windows os" executable with PyInstaller
'''
'''
M""""""""M dP dP
Mmmm mmmM 88 88
MMMM MMMM 88d888b. 88d888b. .d8888b. .d8888b. .d888b88
MMMM MMMM 88' `88 88' `88 88ooood8 88' `88 88' `88
MMMM MMMM 88 88 88 88. ... 88. .88 88. .88
MMMM MMMM dP dP dP `88888P' `88888P8 `88888P8
MMMMMMMMMM
'''
def run_finish(p, window, script, name=None):
"""
Run PyInstaller
:param command: Command for PyInstaller
:type command: (str)
:param script: Script file including path for use in cleanup
:type script: (str)
:param window: Main PySimpleGUI Window
:type window: (Window)
:param name: Name of file (if --name variable is used) for use in cleanup
:type name: (str)
"""
try:
for line in p.stdout:
oline = line.decode().rstrip()
window.write_event_value('-THREAD CPRINT-', oline)
p.wait()
window.write_event_value('-THREAD CPRINT-', "[EXE Maker] Cleaning up...")
source_path, source_filename = os.path.split(script)
if name:
folder_to_remove = os.path.join(source_path, name)
file_to_remove = os.path.join(source_path, name + '.spec')
else:
filename_no_ext, _ = os.path.splitext(source_filename)
folder_to_remove = os.path.join(source_path, f"psc_{filename_no_ext}_tmp")
file_to_remove = os.path.join(source_path, filename_no_ext + '.spec')
shutil.rmtree(folder_to_remove)
os.remove(file_to_remove)
window.write_event_value('-THREAD FINISHED-', '[EXE Maker] ****************** Finished ******************')
except Exception as e:
print(f'EXCEPTION in thread {e}')
window.write_event_value('-THREAD FAILED-', e)
'''
M"""""`'"""`YM oo
M mm. mm. M
M MMM MMM M .d8888b. dP 88d888b.
M MMM MMM M 88' `88 88 88' `88
M MMM MMM M 88. .88 88 88 88
M MMM MMM M `88888P8 dP dP dP
MMMMMMMMMMMMMM
'''
def main():
"""
Main function for Demo_EXE_Maker
"""
ver = version # make a local copy for debugging
icon = b'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAANnklEQVR4nL1aa4xd1XX+vrX3ufece++Mx6+a8rANsbEhhoaHZ8YJxNAqNCp1CyJOE6mtK6jSJFUbVWnViNK4TqpWSFXTEKUKjdKGV6XgH4laU1pVqXFC7RkKsUONwQ8oBkzwA3se99x7z2Ov1R93BgzM2L4Gs0b3x2jvvc769nrutTdwBmTYKLZ2qz+Tue+GDEZbu9UbTM4F87cwtfXmDCbv+W+9ubd8Z6OJwXimcp5y4kZslE3YpEevevb8alV+R8BfFbAOg55maa9kpDi18kiJ8K/mykcGtl/xPNDVEkE7HYNZpTFsFG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'
sg.set_options(icon=icon) # first make sure version of PySimpleGUI is high enough
if int(sg.__version__.split('.')[0]) == 4 and int(sg.__version__.split('.')[1]) < 54:
sg.popup_error('You need a version of PySimpleGUI >= 4.54.0 to run',
f'You are running version {sg.__version__}')
exit()
variable_list = ['--name', '--upx-dir', '--log-level', '--version-file', '--manifest', '--osx-bundle-identifier',
'--runtime-tmpdir', '--target-architecture', '--codesign-identity', '--osx-entitlements-file',
'--splash']
bool_list = ['--ascii', '--clean', '--strip', '--noupx', '--uac-admin', '--uac-uiaccess',
'--win-private-assemblies',
'--win-no-prefer-redirects', '--bootloader-ignore-signals', '--disable-windowed-traceback']
addition_list = ['--paths', '--additional-hooks-dir', '--runtime-hook']
multi_variable_list = ['--exclude-module', '--upx-exclude', '--collect-submodules', '--collect-data',
'--collect-binaries',
'--collect-all', '--copy-metadata', '--recursive-copy-metadata']
bool_touched = []
variable_touched = {}
addition_touched = {}
multi_variable_touched = {}
sg.theme('DarkPurple4')
main_tab = [[sg.HorizontalSeparator()],
[sg.Text('PSG Compiler - Convert Your Python Program to Binary', font='Any 15'), sg.Push(),
sg.Image(sg.EMOJI_BASE64_DREAMING, key='--STATUS_IMAGE--')],
# [sg.Text('Requires PySimpleGUI >= 4.54.0', font='_ 9',)],
[sg.Text('Python Script: ', s=20), sg.Input(key='-SOURCEFILE-', expand_x=True, enable_events=True),
sg.FileBrowse(target='-SOURCEFILE-', file_types=(("Python Files", "*.py *.pyw *.PY *.PYW"),))],
[sg.Text('Icon: ', s=20), sg.Input(key='-ICONFILE-', expand_x=True, enable_events=True),
sg.FileBrowse(target='-ICONFILE-', file_types=(("Icon Files", "*.ico"),))],
[sg.Text('Optional specific pyinstaller: ', s=20), sg.Input(key='-PYINSTALLER-', expand_x=True),
sg.FileBrowse(target='-PYINSTALLER-', file_types=(("All Files", "*.*"),))],
[sg.Text('Arguments: ', s=10), sg.Button('--onefile', key='-ONEFILE BUTTON-', enable_events=True, expand_x=True), sg.Button('--windowed', key='-WINDOWED BUTTON-', enable_events=True, expand_x=True)],
[sg.HorizontalSeparator()],
[sg.Frame('Command', font='Any 13', expand_x=True, layout=[
[sg.Multiline('--onefile --windowed', key='-COMMAND-', s=(None, 7), expand_x=True)]])],
[sg.HorizontalSeparator()],
[sg.Frame('Output', font='Any 13', expand_x=True, expand_y=True, layout=[
[sg.Multiline(font='Courier 10', key='-OUTPUT-', size=(85,10), expand_x=True, expand_y=True, reroute_cprint=True, write_only=True, autoscroll=True)]])],
[sg.HorizontalSeparator()],
[sg.Push(), sg.T('Click Me for PyInstaller Help', enable_events=True, key='-PYINSTALLER HELP-', tooltip='If you have problems with PyInstaller, click and\nyou will be taken to the help page'), sg.Push()],
[sg.Button("CONVERT", expand_x=True), sg.Sizegrip()],
]
# :O
arguments_tab = []
size = max([len(v) for v in variable_list])
for variable in variable_list:
arguments_tab.append([sg.T(variable.replace('--', ''), s=size), sg.Input(k=variable, enable_events=True, expand_x=True)])
bool_tab = []
size = max([len(v) for v in bool_list])
for variable in bool_list:
bool_tab.append(
[sg.Checkbox(variable.replace('--', ''), k=variable, enable_events=True, )])
# Start addition of listbox
additions_tab = []
size = max([len(v) for v in addition_list])
for variable in addition_list:
additions_tab.append([sg.T(variable.replace('--', ''), font='_ 15')])
additions_tab.append([sg.Listbox(values=list(), select_mode=sg.SELECT_MODE_EXTENDED, k=f"COMBO_{variable}", size=(None, 5), expand_x=True, expand_y=True),
sg.Input(k=f"KEY_{variable}", visible=False, enable_events=True), sg.Button("(-)", k=f"REM_{variable}"),
sg.FolderBrowse("(+)", target=f"KEY_{variable}")])
multi_var_tab = []
size = max([len(v) for v in multi_variable_list])
for variable in multi_variable_list:
multi_var_tab.append(
[sg.T(variable.replace('--', ''), s=size), sg.Listbox(values=list(), select_mode=sg.SELECT_MODE_EXTENDED, k=f"COMBO_{variable}", expand_x=True, expand_y=True),
sg.Button('(-)', k=f"REM_{variable}"), sg.Button('(+)', k=f"ADD_{variable}")])
layout = [[sg.TabGroup([[sg.Tab('Home', main_tab), sg.Tab('Arguments', arguments_tab, expand_x=True, ), sg.Tab('Booleans', bool_tab),
sg.Tab('Additions', additions_tab), sg.Tab('Other', multi_var_tab)]], expand_x=True, expand_y=True)]]
right_click_menu = ['', ['Edit Me', 'Version', 'File Location', f'Version {version}', f'PyInstaller {PyInstaller.__version__}', 'Exit']]
window = sg.Window('PSG Compiler', layout, right_click_menu=right_click_menu, finalize=True, resizable=True)
[window[variable].block_focus() for variable in bool_list]
window['-PYINSTALLER HELP-'].set_cursor('Hand1')
counter = 0
while True:
event, values = window.read(timeout=None)
counter += 1
if event in ('Exit', 'Quit', None):
break
elif event == 'File Location':
sg.popup_scrolled('This Python file is:', __file__)
elif event == 'Edit Me':
sg.execute_editor(__file__)
elif event == 'Version':
sg.popup_scrolled(f'psgcompiler version {ver}', sg.get_versions(), f'PyInstaller version for this Python version: {PyInstaller.__version__}', f'Source file {__file__}')
elif event == '-THREAD CPRINT-':
sg.cprint(values[event])
elif event == '-THREAD FINISHED-':
window['CONVERT'].update(disabled=False)
window['--STATUS_IMAGE--'].update(sg.EMOJI_BASE64_HAPPY_JOY)
sg.cprint("[EXE Maker] *********************** Finished ***********************", colors='white on red')
window.ding()
elif event == '-THREAD FAILED-':
window['CONVERT'].update(disabled=False)
window['--STATUS_IMAGE--'].update(sg.EMOJI_BASE64_FRUSTRATED)
sg.cprint("[EXE Maker] *********************** FAILED ***********************", colors='white on red')
sg.cprint(values[event], colors='white on red')
window.ding()
elif event in '-ONEFILE BUTTON-':
if window['-ONEFILE BUTTON-'].get_text() == '--onefile':
window['-ONEFILE BUTTON-'].update('--onedir')
else:
window['-ONEFILE BUTTON-'].update('--onefile')
elif event == '-WINDOWED BUTTON-':
if window['-WINDOWED BUTTON-'].get_text() == '--windowed':
window['-WINDOWED BUTTON-'].update('--console')
else:
window['-WINDOWED BUTTON-'].update('--windowed')
elif event in variable_list:
if values[event]:
variable_touched[event] = values[event]
else:
try:
variable_touched.pop(event)
except KeyError:
pass
elif event in bool_list:
if values[event]:
bool_touched.append(event)
else:
bool_touched.remove(event)
# HOLY CRAP YOU CAN DO THIS??
elif event in [f"{pre}_{varz}" for pre in ['ADD', 'REM', 'KEY'] for varz in
(addition_list + multi_variable_list)]:
using_variable = event[4:]
if event.startswith('ADD'):
if using_variable in multi_variable_touched.keys():
multi_variable_touched[using_variable] += [sg.popup_get_text(f"Value for {using_variable.replace('--', '')}")]
else:
multi_variable_touched[using_variable] = [sg.popup_get_text(f"Value for {using_variable.replace('--', '')}")]
window[f"COMBO_{using_variable}"].update(values=multi_variable_touched[using_variable])
elif event.startswith('REM'):
# Here it can work with additions OR multi_variable so let's check both.
try:
if using_variable in multi_variable_list:
if using_variable in multi_variable_touched.keys():
for x in values[f"COMBO_{using_variable}"]:
multi_variable_touched[using_variable].remove(x)
if not multi_variable_touched[using_variable]:
multi_variable_touched.pop(using_variable)
window[f"COMBO_{using_variable}"].update(values=list())
else:
window[f"COMBO_{using_variable}"].update(values=multi_variable_touched[using_variable])
else:
if using_variable in addition_touched.keys():
for x in values[f"COMBO_{using_variable}"]:
addition_touched[using_variable].remove(x)
if not addition_touched[using_variable]:
addition_touched.pop(using_variable)
window[f"COMBO_{using_variable}"].update(values=list())
else:
window[f"COMBO_{using_variable}"].update(values=addition_touched[using_variable])
except Exception as ex:
sg.cprint(ex)
pass
elif event.startswith('KEY'):
if (using_variable not in addition_touched.keys()) or (using_variable in addition_touched.keys() and values[f"KEY_{using_variable}"] not in addition_touched[using_variable]):
if using_variable in addition_touched.keys():
addition_touched[using_variable] += [values[f"KEY_{using_variable}"]]
else:
addition_touched[using_variable] = [values[f"KEY_{using_variable}"]]
window[f"COMBO_{using_variable}"].update(values=addition_touched[using_variable])
else:
sg.PopupError('Oh-No!', 'The directory or file you have attempted to has been marked as a duplicate, and therefore has not been added.')
elif event == 'CONVERT':
window['CONVERT'].update(disabled=True)
command_raw = f"pyinstaller {values['-COMMAND-']}"
sg.cprint("[EXE Maker] Starting process...")
try:
name = None
if '--name' in variable_touched.keys():
name = variable_touched['--name']
window['--STATUS_IMAGE--'].update(sg.EMOJI_BASE64_YIKES)
command = values['-PYINSTALLER-'] if values['-PYINSTALLER-'] else 'pyinstaller'
p = sg.execute_command_subprocess(command, values['-COMMAND-'], pipe_output=True)
thread = Thread(target=run_finish, args=(p, window, values['-SOURCEFILE-'], name)).start()
except:
window['CONVERT'].update(disabled=False)
sg.PopupError('Something went wrong',
'close this window and copy command line from text printed out in main_tab window',
'Additional info is also listen in the output log.')
sg.cprint('Raw Command For PyInstaller:\n\n', command_raw)
elif event == '-PYINSTALLER HELP-':
webbrowser.open_new_tab(PYINSTALLER_HELP_URL)
# Thank you!
command = f"{window['-ONEFILE BUTTON-'].get_text()} {window['-WINDOWED BUTTON-'].get_text()} "
for key in variable_list:
if values[key]:
command += f"{key} {values[key]} "
for key in multi_variable_touched.keys():
for i in multi_variable_touched[key]:
command += f'{key} "{i}" '
for key in addition_touched.keys():
for i in addition_touched[key]:
command += f'{key} "{i}" '
for key in bool_touched:
command += f"{key} "
if values['-ICONFILE-']:
icon = values['-ICONFILE-']
command += f'-i "{icon}" '
if values['-SOURCEFILE-']:
script = values['-SOURCEFILE-']
source_path, source_filename = os.path.split(script)
filename_no_ext, _ = os.path.splitext(source_filename)
command += f'--workpath "{source_path}/psc_{filename_no_ext}_tmp" --distpath "{source_path}" --specpath "{source_path}" "{script}"'
window['-COMMAND-'].update(command)
window.close()
sys.exit(0)
if __name__ == '__main__':
main()