forked from TransparentLC/realesrgan-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
realesrgan-gui.spec
113 lines (106 loc) · 2.52 KB
/
realesrgan-gui.spec
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
import os
import sys
from PyInstaller.utils.hooks import collect_data_files
a = Analysis(
['main.py'],
datas=[
('theme', 'theme'),
('i18n.ini', '.'),
('icon-256px.ico', '.'),
('icon-128px.png', '.'),
# macOS下通过app实现通知,打包时需要附带
*(collect_data_files('notifypy') if sys.platform == 'darwin' else []),
],
hiddenimports=[
'PIL._tkinter_finder',
],
hookspath=[
'pyi-hooks',
],
excludes=[
'_asyncio',
'_bz2',
'_decimal',
'_hashlib',
'_lzma',
*(['_multiprocessing'] if sys.platform == 'win32' else []),
'_queue',
'_ssl',
'pyexpat',
'unicodedata',
],
)
# Windows 10+已经自带UCRT了,打包时不需要附带
a.binaries = [
x
for x in a.binaries
if not any(x[0].startswith(y) for y in {
'api-ms-win-',
'ucrtbase.dll',
})
]
# tcl/tk相关的没有实际使用的大量小文件,在不使用onefile的情况下打包测试,即使不附带这些文件也后不影响运行
a.datas = [
x
for x in a.datas
if not any(x[0].startswith(y) for y in {
os.path.join('tcl', 'encoding'),
os.path.join('tcl', 'http'),
os.path.join('tcl', 'msgs'),
os.path.join('tcl', 'opt'),
os.path.join('tcl', 'tzdata'),
os.path.join('tcl8'),
os.path.join('tk', 'images'),
os.path.join('tk', 'msgs'),
})
]
print('Binaries:')
for i in a.binaries:
print(i)
print('Datas:')
for i in a.datas:
print(i)
pyz = PYZ(a.pure, a.zipped_data)
if os.environ.get('REGUI_ONEFILE'):
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='realesrgan-gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
icon='icon-256px.ico',
)
else:
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='realesrgan-gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
icon='icon-256px.ico',
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
name='realesrgan-gui',
strip=False,
upx=True,
)