-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSViewer.spec
85 lines (77 loc) · 2.64 KB
/
CSViewer.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
# -*- mode: python -*-
from pathlib import Path
import os
import sys
import importlib
# add qtmodern qss files
package_imports = [["qtmodern", ["resources/frameless.qss", "resources/style.qss"]]]
added_file = []
for package, files in package_imports:
proot = Path(importlib.import_module(package).__file__).parent
added_file.extend((proot / f, package) for f in files)
# add assets
assets = "assets"
icon_files = [f for f in os.listdir(assets) if os.path.isfile(os.path.join(assets, f))]
for icon_file in icon_files:
added_file.extend([(
Path(os.path.abspath(os.path.join(assets, icon_file) )),
assets
)])
block_cipher = None
a = Analysis(["CSViewer.py"],
pathex=["/Users/robin/PycharmProjects/CSViewer"],
binaries=[],
datas=added_file,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
if sys.platform == "darwin":
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name="CSViewer",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=False,
icon=os.path.abspath(os.path.join(assets, "icon-512.icns"))
)
elif sys.platform == "win32" or sys.platform == "win64" or sys.platform == "linux":
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name="CSViewer",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=False,
icon=os.path.abspath(os.path.join(assets, "icon-512.ico"))
)
if sys.platform == "darwin":
app = BUNDLE(exe,
name="CSViewer.app",
info_plist={
"NSHighResolutionCapable": "True",
"LSBackgroundOnly": "False",
"NSRequiresAquaSystemAppearance": "True"
# should be false to support dark mode
# known bug: https://github.com/pyinstaller/pyinstaller/issues/4615 with pyinstaller
# need to recompile pyinstaller with SDK >= 10.13
},
icon=os.path.abspath(os.path.join(assets, "icon-512.icns"))
)