-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyDoc.spec
More file actions
92 lines (77 loc) · 2.38 KB
/
Copy pathPyDoc.spec
File metadata and controls
92 lines (77 loc) · 2.38 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
# -*- mode: python ; coding: utf-8 -*-
"""
PyInstaller spec for PyDoc v1.0.0 Stable.
Build:
pip install pyinstaller pywebview pystray pillow keyboard
pyinstaller PyDoc.spec # -> dist/PyDoc.exe (single file, no console)
This bundles the web UI (web/), the offline Material Symbols font and icon
list, and the default themes.json into a self-contained executable. Runtime
data (config.json, shortcuts.json, store.json, Shortcuts/, Icons/, Profiles/,
Screenshots/) is created next to the .exe on first run.
Drop an icon at Icons/app.ico before building to brand the executable.
"""
import os
from PyInstaller.utils.hooks import collect_all
block_cipher = None
HERE = os.path.abspath(os.getcwd())
# --- bundle the front-end + offline assets + default theme file -------------
datas = [
("web", "web"),
("themes.json", "."),
]
# include a starter Shortcuts folder + README if present
if os.path.isdir(os.path.join(HERE, "Shortcuts")):
datas.append(("Shortcuts", "Shortcuts"))
# --- make sure optional native deps are fully collected ---------------------
hiddenimports = ["webview", "pystray", "PIL", "keyboard"]
binaries = []
for pkg in ("webview", "pystray", "PIL"):
try:
d, b, h = collect_all(pkg)
datas += d
binaries += b
hiddenimports += h
except Exception:
pass
# optional .exe icon
_icon = os.path.join(HERE, "Icons", "app.ico")
icon = _icon if os.path.exists(_icon) else None
a = Analysis(
["launcher.py"],
pathex=[HERE],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=["tkinter", "matplotlib", "numpy", "pytest"],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name="PyDoc",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, # windowed (no console)
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=icon,
version="version_info.txt" if os.path.exists(os.path.join(HERE, "version_info.txt")) else None,
)