-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyinst.py
More file actions
36 lines (29 loc) · 971 Bytes
/
pyinst.py
File metadata and controls
36 lines (29 loc) · 971 Bytes
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
import os
from pathlib import Path
from PyInstaller.__main__ import run
BASE_PATH = Path(__file__).parent
def add_data(path: Path):
"""Returns the arguments needed to add a data file to the executable."""
relpath = path.relative_to(BASE_PATH)
return "--add-data", str(path) + os.pathsep + str(relpath.parent if relpath.is_file() else relpath)
exclusions = [
"cryptography", # imported by werkzeug.serving
"statistics", # imported by random
"tornado", # imported by engineio.async_drivers.tornado
"watchdog", # imported by werkzeug._reloader
]
exclusions_args = []
for excl in exclusions:
exclusions_args.append("--exclude-module")
exclusions_args.append(excl)
run(
[
"--onefile",
"--name",
"digipad",
*add_data(BASE_PATH / "digipad/app/template.html"),
*add_data(BASE_PATH / "digipad/app/static"),
*exclusions_args,
str(BASE_PATH / "digipad/__main__.py"),
]
)