forked from dynobo/normcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
49 lines (41 loc) · 1.23 KB
/
build.py
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
# Default
import os
import sys
from pathlib import Path
# Extra
import PyInstaller.__main__
import importlib_resources
# Own
import normcap
# WORKAROUND FOR BUG IN PYINSTALLER
(Path(importlib_resources.__file__).parent / "version.txt").touch()
ARGS = [
f"--name=normcap-v{normcap.__version__}",
"--clean",
"--noconfirm",
# "--onefile",
"--onedir",
"--windowed",
# "--debug=all",
# "--log-level=DEBUG",
f"--icon={os.path.join('normcap','ressources', 'normcap.ico')}",
f"--paths={os.path.join('.venv', 'lib', 'python3.8', 'site-packages')}",
"--hidden-import=PIL",
"--hidden-import=PIL._imagingtk",
"--hidden-import=PIL._tkinter_finder",
"--hidden-import=importlib_resources.trees",
"--runtime-hook=rthook.py",
f"--add-data=normcap/ressources{os.pathsep}normcap/ressources",
]
if sys.platform.lower().startswith("linux"):
ARGS.extend(["--add-data=/etc/fonts:fonts", "--runtime-hook=rthook.py"])
if sys.platform.lower().startswith("win"):
ARGS.extend(
[
"--add-data=tessdata;tessdata",
"--runtime-hook=rthook.py",
"--win-private-assemblies",
]
)
ARGS.append(os.path.join("normcap", "__main__.py"))
PyInstaller.__main__.run(ARGS)