-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathmain.spec
More file actions
111 lines (100 loc) · 2.9 KB
/
main.spec
File metadata and controls
111 lines (100 loc) · 2.9 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
# -*- mode: python ; coding: utf-8 -*-
import os
import platform
# general
program_name = "PyPSADiag"
root_dir = os.path.abspath(os.getcwd())
platform_name = platform.system().lower()
extras_dir = os.path.join(root_dir, "extras")
if platform_name == "darwin":
icon_path = os.path.join(extras_dir, "macos", "icon.icns")
program_file = f"{program_name}.app"
console_mode = False # macOS GUI apps should not show a terminal
elif platform_name == "linux":
icon_path = os.path.join(extras_dir, "linux", "icon.png")
program_file = program_name
console_mode = True # keep console for debug on Linux
elif platform_name == "windows":
icon_path = os.path.join(extras_dir, "windows", "icon.ico")
program_file = f"{program_name}.exe"
console_mode = True # keep console for debug on Windows
else:
icon_path = None
program_file = program_name
console_mode = True
# resource files
added_files = [
('csv/*.csv', 'csv'),
('data/*.json', 'data'),
('json/*', 'json'),
('simu/*', 'simu'),
('i18n/Languages.json', 'i18n'),
('i18n/flags/*', 'i18n/flags'),
('i18n/translations/*', 'i18n/translations'),
]
if platform_name == "windows":
added_files += [ ('VCIBridge.py', './') ]
# PyInstaller build pipeline
a = Analysis(
['main.py'],
pathex=[root_dir],
binaries=[],
datas=added_files,
hiddenimports=[
# list extra imports PyInstaller sometimes misses
"PySide6.QtCore",
"PySide6.QtGui",
"PySide6.QtWidgets",
"PySide6.QtNetwork",
"version", # local version module
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=1,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name=program_name,
debug=False,
bootloader_ignore_signals=False,
strip=False if platform_name == "windows" else True, # disable strip on Windows
upx=True, # compress with UPX if available
console=console_mode, # depends on platform
disable_windowed_traceback=False,
argv_emulation=False, # set to True if you need drag&drop args on macOS
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=icon_path,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False if platform_name == "windows" else True, # disable strip on Windows
upx=True,
upx_exclude=[],
name=program_name,
)
# bundle step for macos
if platform_name == "darwin":
app = BUNDLE(
coll,
name=f"{program_name}.app",
icon=icon_path,
bundle_identifier="Barracuda09.PyPSADiag.py",
info_plist={
"NSHighResolutionCapable": "True",
"CFBundleShortVersionString": "0.1.0",
"CFBundleVersion": "0.1.0",
"CFBundleName": program_name,
"CFBundleDisplayName": program_name,
}
)