-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathbuild.spec
More file actions
337 lines (303 loc) · 12.6 KB
/
Copy pathbuild.spec
File metadata and controls
337 lines (303 loc) · 12.6 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
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# -*- mode: python ; coding: utf-8 -*-
# pyright: reportUndefinedVariable=false
block_cipher = None
import os, shutil, glob
def collect_data_files():
datas = [
('icon.ico', '.'),
('icon.png', '.'),
('Assets', 'Assets'),
('SFX', 'SFX'),
('icons', 'icons'),
('fonts', 'fonts'),
('legal', 'legal'),
('styles', 'styles'),
('config', 'config'),
]
filtered_datas = []
for src, dst in datas:
if os.path.exists(src):
filtered_datas.append((src, dst))
else:
print(f"File not found (skipped): {src}")
lang_excludes = {'blank.lang', 'en-revisited.lang'}
for f in glob.glob('languages/*.lang'):
if os.path.basename(f) not in lang_excludes:
filtered_datas.append((f, 'languages'))
for f in glob.glob('languages/*.json'):
filtered_datas.append((f, 'languages'))
try:
import docx
docx_dir = os.path.dirname(docx.__file__)
if os.path.exists(docx_dir):
filtered_datas.append((docx_dir, 'docx'))
print("python-docx data files added")
except ImportError:
print("python-docx not installed")
try:
import docxcompose
docxcompose_dir = os.path.dirname(docxcompose.__file__)
templates_dir = os.path.join(docxcompose_dir, 'templates')
if os.path.exists(templates_dir):
filtered_datas.append((templates_dir, 'docxcompose/templates'))
except ImportError:
print("docxcompose not installed")
try:
import pptx
pptx_templates = os.path.join(os.path.dirname(pptx.__file__), 'templates')
if os.path.exists(pptx_templates):
filtered_datas.append((pptx_templates, 'pptx/templates'))
except ImportError:
print("python-pptx not installed")
try:
import comtypes
gen_dir = os.path.join(os.path.dirname(comtypes.__file__), 'gen')
if os.path.exists(gen_dir):
filtered_datas.append((gen_dir, 'comtypes/gen'))
except ImportError:
print("comtypes not installed")
try:
from PyInstaller.utils.hooks import collect_all
pdf2docx_datas, _, _ = collect_all("pdf2docx")
filtered_datas.extend(pdf2docx_datas)
except Exception as e:
print(f"pdf2docx collect_all failed: {e}")
try:
from PyInstaller.utils.hooks import collect_data_files as _cdf
cv2_datas = _cdf("cv2")
filtered_datas.extend(cv2_datas)
except Exception as e:
print(f"cv2 collect failed: {e}")
return filtered_datas
try:
from PyInstaller.utils.hooks import collect_all as _ca
_, _pdf2docx_bins, _pdf2docx_hidden = _ca("pdf2docx")
except Exception:
_pdf2docx_bins, _pdf2docx_hidden = [], []
try:
from PyInstaller.utils.hooks import collect_dynamic_libs, collect_data_files as _cdf
_cv2_bins = collect_dynamic_libs("cv2")
_cv2_hidden = ["cv2"]
except Exception:
_cv2_bins, _cv2_hidden = [], []
SHARED_HIDDEN = [
'cryptography.hazmat.primitives.kdf.pbkdf2',
'cryptography.hazmat.primitives.hashes',
'cryptography.hazmat.backends',
*_pdf2docx_hidden,
*_cv2_hidden,
'pdf2docx', 'pdf2docx.main', 'pdf2docx.converter',
'pdf2docx.common', 'pdf2docx.common.share', 'pdf2docx.common.algorithm',
'pdf2docx.common.constants', 'pdf2docx.common.Collection',
'pdf2docx.common.docx', 'pdf2docx.common.Element', 'pdf2docx.common.Block',
'pdf2docx.text', 'pdf2docx.text.TextSpan', 'pdf2docx.text.TextBlock',
'pdf2docx.text.Lines', 'pdf2docx.text.Line', 'pdf2docx.text.Char',
'pdf2docx.text.Spans',
'pdf2docx.image', 'pdf2docx.image.ImagesExtractor', 'pdf2docx.image.ImageBlock',
'pdf2docx.image.ImageSpan', 'pdf2docx.image.Image',
'pdf2docx.table', 'pdf2docx.table.Row', 'pdf2docx.table.TableStructure',
'pdf2docx.table.Rows', 'pdf2docx.table.TablesConstructor',
'pdf2docx.table.Cells', 'pdf2docx.table.Cell', 'pdf2docx.table.TableBlock',
'pdf2docx.table.Border',
'pdf2docx.shape', 'pdf2docx.shape.Paths', 'pdf2docx.shape.Shapes',
'pdf2docx.shape.Path', 'pdf2docx.shape.Shape',
'pdf2docx.font', 'pdf2docx.font.Fonts',
'pdf2docx.page', 'pdf2docx.page.RawPageFitz', 'pdf2docx.page.RawPage',
'pdf2docx.page.Page', 'pdf2docx.page.RawPageFactory',
'pdf2docx.page.BasePage', 'pdf2docx.page.Pages',
'pdf2docx.layout', 'pdf2docx.layout.Blocks', 'pdf2docx.layout.Section',
'pdf2docx.layout.Sections', 'pdf2docx.layout.Layout',
'pdf2docx.layout.Column',
'docx', 'docx.document', 'docx.opc', 'docx.opc.constants',
'docx.opc.part', 'docx.opc.pkgreader', 'docx.opc.api',
'docx.shared', 'docx.enum', 'docx.enum.style',
'docx.enum.section', 'docx.enum.text', 'docx.enum.dml',
'docx.oxml', 'docx.oxml.ns', 'docx.oxml.shared',
'docx.oxml.document', 'docx.oxml.text', 'docx.oxml.table',
'docx.parts', 'docx.parts.document', 'docx.parts.image',
'docx.styles', 'docx.styles.style', 'docx.styles.latent',
'docx.table', 'docx.text', 'docx.text.paragraph',
'docx.text.run', 'docx.text.parfmt', 'docx.image',
'docx.image.png', 'docx.image.jpeg',
'docxcompose', 'docxcompose.composer', 'docxcompose.core',
'docxcompose.properties', 'docxcompose.registry',
'reportlab', 'reportlab.lib', 'reportlab.lib.pagesizes',
'reportlab.lib.units', 'reportlab.lib.styles',
'reportlab.lib.colors', 'reportlab.lib.enums',
'reportlab.platypus', 'reportlab.platypus.tables',
'reportlab.platypus.flowables', 'reportlab.pdfbase',
'reportlab.pdfbase.pdfmetrics', 'reportlab.pdfbase.ttfonts',
'PIL', 'PIL.Image', 'PIL.ImageDraw', 'PIL.ImageFont', 'PIL.ImageOps',
'docx2pdf', 'docx2pdf.util',
'comtypes', 'comtypes.client', 'comtypes.gen',
'comtypes.persistence', 'comtypes.automation',
'pythoncom', 'pywintypes',
'pyzipper',
'PySide6.QtMultimedia', 'PySide6.QtMultimediaWidgets',
'PySide6.QtNetwork', 'PySide6.QtCore', 'PySide6.QtGui',
'PySide6.QtWidgets',
'fitz', 'pypdf',
'matplotlib', 'matplotlib.pyplot',
'matplotlib.backends.backend_qtagg',
'matplotlib.backends.backend_agg',
'matplotlib.figure', 'matplotlib.patches',
'cycler', 'kiwisolver', 'dateutil', 'dateutil.parser',
'dateutil.relativedelta', 'pytz',
'numpy', 'numpy.core', 'numpy.core.multiarray',
'numpy.core._multiarray_umath',
'fontTools', 'fontTools.ttLib', 'fontTools.misc',
'fontTools.misc.encodingTools', 'fontTools.misc.textTools',
'openpyxl', 'openpyxl.styles', 'openpyxl.utils',
'pptx', 'pptx.util', 'pptx.enum.shapes', 'pptx.enum.chart',
'cv2',
'lxml', 'lxml.etree', 'lxml._elementpath', 'lxml.html', 'ebooklib',
'pillow_heif', 'weasyprint',
'rawpy',
'config', 'database', 'translations', 'widgets', 'external_binaries',
'utils', 'utils.translation_mixin',
'dialogs', 'dialogs.terms_dialog', 'dialogs.word_to_pdf_dialog',
'dialogs.pdf_to_word_dialog', 'dialogs.splash_screen', 'dialogs.preview_dialog',
'dialogs.password_dialog', 'dialogs.split_dialog', 'dialogs.compression_dialog',
'dialogs.batch_convert_dialog', 'dialogs.batch_rename_dialog',
'dialogs.settings_dialog', 'dialogs.conversion_options_dialog',
'dialogs.pdf_protection_dialog', 'dialogs.merge_order_dialog',
'dashboard', 'history',
'templates', 'templates.templates', 'templates.template_manager',
'templates.create_template_dialog', 'templates.template_editor_dialog',
'app', 'app.logic', 'app.ui',
'app.mixins', 'app.mixins.optimization', 'app.mixins.image_to_pdf',
'app.mixins.batch', 'app.mixins.pdf_operations',
'app.mixins.pdf_to_word', 'app.mixins.word_to_pdf',
'app.mixins.compression', 'app.mixins.archive_engines', 'app.mixins.file_management',
'app.mixins.panels', 'app.mixins.project_management',
'app.mixins.theme_language',
'app.mixins.pdf_optimizer', 'app.mixins.office_optimizer',
'app.mixins.media_optimizer', 'app.mixins.web_optimizer',
'app.mixins.epub_optimizer', 'app.mixins.image_optimizer',
'converter', 'converter.converters', 'converter.advanced_db',
'converter.html_inline',
'converter.mixins', 'converter.mixins.document_converters',
'converter.mixins.image_converters', 'converter.mixins.media_converters',
'converter.mixins.office_com', 'converter.mixins.rtf_native',
'converter.mixins.pptx_native', 'converter.mixins.html_renderers',
'converter.mixins.pdf_renderers', 'converter.mixins.epub_renderers',
'converter.helpers', 'converter.registry',
'advanced_conversions', 'donate',
'achievements', 'achievements.achievements_system',
'achievements.achievements_ui', 'achievements.achievements_popup',
'achievements.rank_popup', 'achievements.achievements_manager',
'special_events_manager', 'system_notifier',
'context_menu', 'context_menu.window', 'context_menu.formats',
'tasks', 'tasks.watcher', 'tasks.scheduler',
'theme_manager',
'watchdog', 'watchdog.observers', 'watchdog.events',
'apscheduler', 'apscheduler.schedulers.background',
'apscheduler.triggers.cron', 'apscheduler.triggers.interval',
'tomli',
'daemon',
'qss_helpers'
]
SHARED_EXCLUDES = [
'PyQt5', 'PyQt6', 'PySide2', 'tkinter',
'pytest', 'unittest', 'nose', 'sphinx', 'docutils',
'torch', 'torchvision', 'torchaudio',
'scipy', 'skimage', 'sklearn', 'numba', 'llvmlite',
'IPython', 'jedi', 'parso', 'prompt_toolkit',
'zmq', 'tornado', 'ipykernel', 'ipython_genutils',
'pandas', 'babel',
'PySide6.QtBluetooth', 'PySide6.QtDBus',
'PySide6.QtLocation', 'PySide6.QtNfc',
'PySide6.QtPositioning', 'PySide6.QtRemoteObjects',
'PySide6.QtScxml', 'PySide6.QtSensors',
'PySide6.QtSerialBus', 'PySide6.QtSerialPort',
'PySide6.QtSql', 'PySide6.QtTest',
'PySide6.QtWebChannel', 'PySide6.QtWebEngine',
'PySide6.QtWebEngineCore', 'PySide6.QtWebEngineWidgets',
'PySide6.QtWebSockets',
'PySide6.QtQml', 'PySide6.QtQuick', 'PySide6.QtQuickWidgets',
]
UPX_EXCLUDE = [
'Qt6Multimedia.dll', 'Qt6MultimediaWidgets.dll',
'Qt6PrintSupport.dll', 'Qt6Qml.dll', 'Qt6Quick.dll', 'Qt6DBus.dll',
'libopenblas*.dll', 'libblas*.dll',
'_multiarray_umath*.pyd', '_numpy_core*.pyd', 'multiarray*.pyd',
'numpy.core*.dll',
'python3*.dll', 'python*.dll',
'vcruntime*.dll', 'msvcp*.dll', 'msvcr*.dll',
'api-ms-win*.dll', 'ucrtbase.dll',
'_mupdf*.pyd', 'mupdf*.dll', '_fitz*.pyd',
]
a = Analysis(
['main.py'],
pathex=[],
binaries=[] + _pdf2docx_bins + _cv2_bins,
datas=collect_data_files(),
hiddenimports=SHARED_HIDDEN,
hookspath=[],
hooksconfig={'matplotlib': {'backends': ['qtagg', 'agg']}},
runtime_hooks=[],
excludes=SHARED_EXCLUDES,
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
target_arch='x86_64',
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='FCP',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=UPX_EXCLUDE,
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
icon='icon.ico',
version='version_info.txt',
manifest='manifest.xml',
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=UPX_EXCLUDE,
name='FCP',
)
dist_dir = os.path.join(DISTPATH, 'FCP', '_internal')
for d in glob.glob(os.path.join(dist_dir, '*.dist-info')):
shutil.rmtree(d)
for py in glob.glob(os.path.join(dist_dir, '**', '*.py'), recursive=True):
os.remove(py)
for pyc in glob.glob(os.path.join(dist_dir, '**', '*.pyc'), recursive=True):
os.remove(pyc)
for cache in glob.glob(os.path.join(dist_dir, '**', '__pycache__'), recursive=True):
shutil.rmtree(cache, ignore_errors=True)
comtypes_cache = os.path.join(DISTPATH, 'FCP', '_internal', 'comtypes', 'gen')
if os.path.exists(comtypes_cache):
shutil.rmtree(comtypes_cache)
os.makedirs(comtypes_cache)
mpl_sample = os.path.join(dist_dir, 'matplotlib', 'mpl-data', 'sample_data')
if os.path.exists(mpl_sample):
shutil.rmtree(mpl_sample)
mpl_fonts = os.path.join(dist_dir, 'matplotlib', 'mpl-data', 'fonts')
if os.path.exists(mpl_fonts):
for f in glob.glob(os.path.join(mpl_fonts, '**', '*.ttf'), recursive=True):
if 'DejaVu' not in os.path.basename(f):
os.remove(f)
for f in glob.glob(os.path.join(mpl_fonts, '**', '*.afm'), recursive=True):
os.remove(f)
old_ffmpeg = os.path.join(dist_dir, 'cv2', 'opencv_videoio_ffmpeg4100_64.dll')
if os.path.exists(old_ffmpeg):
os.remove(old_ffmpeg)
automation_dir = os.path.join(DISTPATH, 'FCP', 'automation')
os.makedirs(automation_dir, exist_ok=True)