-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathMouseTracks.spec
More file actions
228 lines (209 loc) · 6.88 KB
/
MouseTracks.spec
File metadata and controls
228 lines (209 loc) · 6.88 KB
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
# -*- mode: python ; coding: utf-8 -*-
import glob
import os
import sys
import certifi
from scipy import __file__ as scipy_path
sys.path.insert(0, os.path.abspath('.'))
from mousetracks2 import __version__ as version
from mousetracks2.constants import PACKAGE_IDENTIFIER
from mousetracks2.utils.update import generate_exe_name
target_name = os.environ.get('EXE_BASENAME', generate_exe_name(with_extension=False))
datas = [
('config/colours.txt', 'config'),
('config/AppList.txt', 'config'),
('config/language/strings/en_GB.ini', 'config/language/strings'),
('config/language/keyboard/keys/en_GB.ini', 'config/language/keyboard/keys'),
('config/language/keyboard/layout/en_US.txt', 'config/language/keyboard/layout'),
('resources/images/icon.png', 'resources/images'),
('resources/fonts/liberation-sans.regular.ttf', 'resources/fonts'),
(certifi.where(), 'certifi'),
]
excludes = ['scipy', 'markupsafe']
hiddenimports = ['resources.build.scipy', 'pynput.keyboard._xorg', 'pynput.mouse._xorg', '_cffi_backend']
upx_exclude = ['resources/build/scipy/ndimage/_nd_image.cp311-win_amd64.dll.a']
a_main = Analysis(
['launch.py'],
pathex=[],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=excludes,
noarchive=False,
optimize=0,
)
pyz_main = PYZ(a_main.pure)
# Remove unused binaries
binaries = [
(name, path, type) for name, path, type in a_main.binaries
if name.startswith((
os.path.join('PySide6', 'Qt6Core'),
os.path.join('PySide6', 'Qt6Gui'),
os.path.join('PySide6', 'Qt6Widgets'),
os.path.join('PySide6', 'QtCore'),
os.path.join('PySide6', 'QtGui'),
os.path.join('PySide6', 'QtWidgets'),
os.path.join('PySide6', 'plugins', 'platforms'),
os.path.join('PySide6', 'plugins', 'styles'),
))
or not (
name.startswith(os.path.join('PySide6', 'Qt6')) and name.endswith('.dll')
or name.startswith(os.path.join('PySide6', 'Qt')) and name.endswith('.pyd')
or name.startswith((
os.path.join('PIL', '_webp'), # 398 kb
os.path.join('PIL', '_imagingcms'), # 257 kb
os.path.join('PySide6', 'plugins'), # 2864 kb
os.path.join('PySide6', 'QtNetwork.abi3.so'),
os.path.join('numpy', 'random'), # 2288 kb
os.path.join('numpy', 'fft'), # 273 kb
))
or name in (
os.path.join('PySide6', 'opengl32sw.dll'), # 20157 kb
'python27.dll', # 3352 kb
'_decimal.pyd', # 248 kb
'_lzma.pyd', # 156 kb
)
# Extra files added by Github Actions
or name == 'ucrtbase.dll' or name.startswith('api-ms-win-')
# Linux
or name.startswith(os.path.join('PySide6', 'Qt', 'plugins', 'imageformats')) and name.endswith('.so') and 'png' not in name # 1.8 mb
or name.startswith(os.path.join('PySide6', 'Qt', 'plugins', 'tls')) and name.endswith('.so') # 0.5 mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6Network')) # 2.1mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6Quick')) # 7.6mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6Qml')) # 6.3mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6OpenGL')) # 5.2mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6Pdf')) # 5.2mb
or name.startswith(os.path.join('PySide6', 'Qt', 'lib', 'libQt6Svg')) # 0.5mb
)
]
# Add scipy ndimage binaries
binaries.extend((f'resources/build/scipy/ndimage/{os.path.basename(filepath)}', filepath, 'BINARY')
for filepath in glob.glob(os.path.join(os.path.dirname(scipy_path), 'ndimage', '_nd_image.*')))
# Remove unused data files
exe_datas = [
(name, path, type) for name, path, type in a_main.datas
if not name.startswith(os.path.join('PySide6', 'translations')) # 6037 kb
and not name.startswith('MarkupSafe')
]
exe_main = EXE(
pyz_main,
a_main.scripts,
binaries,
exe_datas,
[],
name=target_name,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=upx_exclude,
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
version='build\\version.rc',
icon=['resources\\images\\icon.ico'],
)
# Portable executable
a_portable = Analysis(
['launch.py'],
pathex=[],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=['resources/build/hooks/portable.py'],
excludes=excludes,
noarchive=False,
optimize=0,
)
pyz_portable = PYZ(a_portable.pure)
exe_portable = EXE(
pyz_portable,
a_portable.scripts,
binaries,
exe_datas,
[],
name=target_name + '-portable',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=upx_exclude,
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
version='build\\version-portable.rc',
icon=['resources\\images\\icon.ico'],
)
# Launcher executable
if sys.platform == 'win32':
a_launcher = Analysis(
['launcher.py'],
pathex=[],
binaries=[],
datas=[],
excludes=[],
hiddenimports=['_cffi_backend'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
noarchive=False,
optimize=0,
)
pyz_launcher = PYZ(a_launcher.pure)
exe_launcher = EXE(
pyz_launcher,
a_launcher.scripts,
a_launcher.binaries,
a_launcher.datas,
[],
name='MouseTracks',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
version='build\\version-installer.rc',
icon='resources/images/icon.ico'
)
# macOS bundle
if sys.platform == 'darwin':
app_main = BUNDLE(
exe_main,
name=f'{target_name}.app',
icon='resources/images/icon.icns',
bundle_identifier=PACKAGE_IDENTIFIER,
info_plist={
'NSHighResolutionCapable': 'True',
'LSBackgroundOnly': 'False',
},
)
app_portable = BUNDLE(
exe_portable,
name=f'{target_name}-portable.app',
icon='resources/images/icon.icns',
bundle_identifier=PACKAGE_IDENTIFIER,
info_plist={
'NSHighResolutionCapable': 'True',
'LSBackgroundOnly': 'False',
},
)