-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.py
86 lines (78 loc) · 2.51 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
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
import os
import platform
import subprocess as sp
package_type = os.environ.get("PACKAGE_TYPE", "onefile")
assert package_type in ("onedir", "onefile"), "PACKAGE_TYPE must be onedir or onefile"
# upgrade dependencies manually
if platform.system() == "Windows":
sp.check_call(["pip", "install", "--upgrade", "pywin32", "cffi"])
sep = ";" if platform.system() == "Windows" else ":"
ICON_PATH = "assets/favicon.ico"
# Use nuitka for faster gui
if platform.system() == "Windows":
args = [
"python",
"-m",
"nuitka",
# "--mingw64",
"--standalone",
f"--output-dir=dist",
"--follow-import-to=fish",
"main.py",
f"--onefile", # default onefile is enough (not unzipping)
"--output-filename=fish",
"--include-data-dir=assets=assets",
"--include-data-dir=locales=locales",
"--include-data-files=fish_audio_preprocess=fish_audio_preprocess/=**/*.py",
"--windows-console-mode=disable",
"--enable-plugins=pkg-resources",
"--enable-plugins=pyqt6",
# --follow-import-to=numpy
"--nofollow-import-to=mkl,click,scipy,pandas,matplotlib,pytest",
"--include-qt-plugins=sensible,multimedia",
"--show-memory",
"--show-progress",
# "--debug",
f"--windows-icon-from-ico={ICON_PATH}",
]
elif platform.system() == "Linux":
args = [
"python",
"-m",
"nuitka",
# "--mingw64",
"--standalone",
f"--output-dir=dist",
"--follow-import-to=fish",
"main.py",
f"--onefile", # default onefile is enough (not unzipping)
"--output-filename=fish",
"--include-data-dir=assets=assets",
"--include-data-dir=locales=locales",
"--include-data-files=fish_audio_preprocess=fish_audio_preprocess/=**/*.py",
"--windows-console-mode=disable",
"--enable-plugins=pkg-resources",
"--enable-plugins=pyqt6",
# --follow-import-to=numpy
"--nofollow-import-to=mkl,click,scipy,pandas,matplotlib,pytest",
"--include-qt-plugins=sensible,multimedia",
"--show-memory",
"--show-progress",
]
else:
args = [
"pyinstaller",
"main.py",
f"--{package_type}",
"-n",
"fish",
"--additional-hooks=extra-hooks",
"--noconfirm",
"--add-data",
f"assets{sep}assets",
"--add-data",
f"locales{sep}locales",
"--noconsole",
f"--icon={ICON_PATH}",
]
sp.check_call(args)