-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkboard.spec
More file actions
122 lines (109 loc) · 4.07 KB
/
Copy pathlinkboard.spec
File metadata and controls
122 lines (109 loc) · 4.07 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
# -*- mode: python ; coding: utf-8 -*-
"""
PyInstaller build spec for LinkBoard.
Build:
pip install pyinstaller
pyinstaller linkboard.spec
Outputs (in ./dist):
* Windows : dist/LinkBoard/LinkBoard.exe (onedir)
* Linux : dist/LinkBoard/LinkBoard (onedir)
* macOS : dist/LinkBoard.app (app bundle)
Notes
* ui.html is bundled as a data file; app.py resolves it via sys._MEIPASS
when frozen (see _resource_dir() in app.py).
* todofile.py is imported normally and picked up automatically, but is also
listed as a hidden import for safety.
* User data (~/.linkboard) is created at runtime and is NOT bundled.
* This is a onedir build (fast start, easy to inspect). To get a single
self-contained file, flip ONEFILE below to True.
"""
import sys
from PyInstaller.utils.hooks import collect_submodules
# --------------------------------------------------------------------------- #
ONEFILE = True # True -> single-file executable (slower start)
APP_NAME = "LinkBoard"
ICON_ICO = "assets/icon.ico" # optional; ignored if missing (Windows)
ICON_ICNS = "assets/icon.icns" # optional; ignored if missing (macOS)
# --------------------------------------------------------------------------- #
import os
block_cipher = None
# Bundle the UI. On onedir builds it lands next to the exe; on onefile it is
# extracted to sys._MEIPASS. In both cases app.py's _resource_dir() finds it.
datas = [("ui.html", ".")]
# pywebview loads a platform GUI backend dynamically; help PyInstaller find it.
hiddenimports = [
"todofile",
"cryptography",
"cryptography.fernet",
"cryptography.hazmat.primitives.kdf.pbkdf2",
"cryptography.hazmat.primitives.hashes",
]
hiddenimports += collect_submodules("webview")
# Best-effort: include the native webview backend for this OS.
if sys.platform.startswith("win"):
hiddenimports += ["webview.platforms.edgechromium", "webview.platforms.mshtml",
"clr", "System"]
elif sys.platform == "darwin":
hiddenimports += ["webview.platforms.cocoa"]
else:
hiddenimports += ["webview.platforms.gtk", "webview.platforms.qt"]
def _icon(path):
return path if os.path.exists(path) else None
a = Analysis(
["app.py"],
pathex=[],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=["tkinter", "pytest", "numpy", "pandas"],
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 ONEFILE:
exe = EXE(
pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [],
name=APP_NAME,
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(ICON_ICO) or _icon(ICON_ICNS),
)
else:
exe = EXE(
pyz, a.scripts, [],
exclude_binaries=True,
name=APP_NAME,
debug=False, bootloader_ignore_signals=False, strip=False,
upx=True, console=False, disable_windowed_traceback=False,
argv_emulation=False, target_arch=None, codesign_identity=None,
entitlements_file=None,
icon=_icon(ICON_ICO) or _icon(ICON_ICNS),
)
coll = COLLECT(
exe, a.binaries, a.zipfiles, a.datas,
strip=False, upx=True, upx_exclude=[], name=APP_NAME,
)
# macOS: wrap into a .app bundle
if sys.platform == "darwin":
app = BUNDLE(
coll if not ONEFILE else exe,
name=APP_NAME + ".app",
icon=_icon(ICON_ICNS),
bundle_identifier="com.linkboard.app",
info_plist={
"CFBundleName": APP_NAME,
"CFBundleDisplayName": APP_NAME,
"CFBundleShortVersionString": "1.0.0",
"CFBundleVersion": "1.0.0",
"NSHighResolutionCapable": True,
"LSMinimumSystemVersion": "10.13",
},
)