-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpdfapps.spec
More file actions
115 lines (108 loc) · 3.7 KB
/
Copy pathpdfapps.spec
File metadata and controls
115 lines (108 loc) · 3.7 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
# -*- mode: python ; coding: utf-8 -*-
import importlib, os, re, sys as _sys
_qa = os.path.dirname(importlib.import_module('qtawesome').__file__)
# Read APP_VERSION from app/constants.py so the macOS bundle stays in sync.
with open('app/constants.py', encoding='utf-8') as _f:
_m = re.search(r'APP_VERSION\s*=\s*"([^"]+)"', _f.read())
_app_version = _m.group(1) if _m else '0.0.0'
# R11-L5: regenerate version_info.txt with APP_VERSION on each build so
# the Windows PE header stays in sync. PyInstaller picks it up via the
# ``version=`` kwarg on EXE(). Helps mitigate AV false positives that
# flag PyInstaller binaries lacking a version-info resource.
_vparts = _app_version.split('.')
while len(_vparts) < 4:
_vparts.append('0')
_vtuple = ', '.join(_vparts[:4])
with open('version_info.txt', 'w', encoding='utf-8') as _vf:
_vf.write(
"VSVersionInfo(\n"
" ffi=FixedFileInfo(\n"
f" filevers=({_vtuple}),\n"
f" prodvers=({_vtuple}),\n"
" mask=0x3f, flags=0x0, OS=0x40004, fileType=0x1,\n"
" subtype=0x0, date=(0, 0),\n"
" ),\n"
" kids=[\n"
" StringFileInfo([\n"
" StringTable('040904B0', [\n"
" StringStruct('CompanyName', 'PDFApps'),\n"
" StringStruct('FileDescription', 'PDFApps - PDF Editor'),\n"
f" StringStruct('FileVersion', '{_app_version}'),\n"
" StringStruct('InternalName', 'PDFApps'),\n"
" StringStruct('LegalCopyright', 'Copyright (c) 2025-2026 PDFApps'),\n"
" StringStruct('OriginalFilename', 'PDFApps.exe'),\n"
" StringStruct('ProductName', 'PDFApps'),\n"
f" StringStruct('ProductVersion', '{_app_version}'),\n"
" ])\n"
" ]),\n"
" VarFileInfo([VarStruct('Translation', [1033, 1200])])\n"
" ]\n"
")\n"
)
a = Analysis(
['pdfapps.py'],
pathex=[],
binaries=[],
datas=[
('icon.ico', '.'),
('pdfapps.svg', '.'),
('app/translations.json', 'app'),
(os.path.join(_qa, 'fonts'), 'qtawesome/fonts'),
],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='PDFApps',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['icon.ico'],
# R11-L5: stamp PE version-info on Windows builds (no-op elsewhere).
version='version_info.txt' if _sys.platform == 'win32' else None,
)
# macOS .app bundle (ignored on other platforms)
if _sys.platform == 'darwin':
_icon = 'icon.icns' if os.path.isfile('icon.icns') else 'icon.ico'
app = BUNDLE(
exe,
name='PDFApps.app',
icon=_icon,
bundle_identifier='com.pdfapps.app',
version=_app_version,
info_plist={
'CFBundleName': 'PDFApps',
'CFBundleDisplayName': 'PDFApps',
'CFBundleExecutable': 'PDFApps',
'CFBundleIdentifier': 'com.pdfapps.app',
'CFBundleVersion': _app_version,
'CFBundleShortVersionString': _app_version,
'LSMinimumSystemVersion': '10.14',
'NSHighResolutionCapable': True,
'CFBundleDocumentTypes': [{
'CFBundleTypeName': 'PDF Document',
'CFBundleTypeRole': 'Editor',
'LSItemContentTypes': ['com.adobe.pdf'],
}],
},
)