-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.spec
126 lines (115 loc) · 2.93 KB
/
main.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
114
115
116
117
118
119
120
121
122
123
124
125
126
# -*- mode: python -*-
single_file = True
name = "PyQtSkeleton"
import sys
import os.path as osp
# Convert logo PNG to ICO
png_filename = osp.join('data', 'logo.png')
#icon_sizes = [(16,16), (32, 32), (48, 48), (64,64), (128,128)]
from PIL import Image
ico_img = Image.open(png_filename)
ico_img.save('build/logo.ico')
block_cipher = None #pyi_crypto.PyiBlockCipher(key='fookey')
# All files from "data" directory
datas = []
for r, d, fs in os.walk("data"):
datas.extend([(osp.join(r, f), r) for f in fs])
datas.append(('build/logo.ico', '.'))
a = Analysis(['main.py'],
pathex=[],
binaries=[],
datas=datas,
hiddenimports=[],
hookspath=[],
runtime_hooks=['rthook.py'],
excludes=[ # Comment if you use these modules
'PyQt5.QtDBus',
'PyQt5.QtWebKit',
'PyQt5.QtNetwork',
'PyQt5.QtOpenGL',
'PyQt5.QtSvg',
'PyQt5.QtTest',
'PyQt5.QtXml',
],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exclude_binaries = (
'qt5_plugins',
'_cffi',
'_hashlib',
'_ssl',
'_tkinter',
'_win32',
'bz2',
'libssl',
'mfc',
'msvcm90',
'msvcr90',
'msvcp90',
'PyQt5.QtSql',
'Qt5DBus',
'Qt5Network',
'Qt5Qml',
'Qt5Quick',
'QtOpenGL',
'QtSql',
'QtSvg',
'QtXml',
'tcl85',
'tk85',
'unicodedata',
'win32evtlog',
'win32pipe',
'win32trace',
'win32wnet',
'win32ui',
'select',
'PyQt5\\Qt\\bin\\d3dcompiler',
'PyQt5\\Qt\\bin\\libEGL',
'PyQt5\\Qt\\bin\\libGLES',
'PyQt5\\Qt\\bin\\opengl',
'PyQt5\\Qt\\plugins\\platforms\\qoffscreen',
'libcrypto',
'libGLES',
)
a.binaries = [binary for binary in a.binaries if
not binary[0].startswith(exclude_binaries)]
exclude_datas = (
r'tcl\encoding',
r'tcl\tzdata',
r'tcl\msgs',
r'tk\images',
r'tk\msgs',
)
a.datas = [data for data in a.datas if not data[0].startswith(exclude_datas)]
if single_file:
exe_files = [
a.binaries,
a.zipfiles,
a.datas]
else:
exe_files = []
exe = EXE(pyz,
a.scripts,
*exe_files,
exclude_binaries=not single_file,
name=name,
debug=False,
bootloader_ignore_signals=False,
#strip=True,
upx=True,
console=False,
icon=osp.join('build', 'logo.ico'))
if not single_file:
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name=name)