44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
import os
|
|
|
|
import PyInstaller.__main__
|
|
from PyQt5.Qt import QT_VERSION_STR
|
|
|
|
args = [
|
|
# "--clean",
|
|
"--distpath", "./dist",
|
|
"--icon", "./src/ui/imgs/neo.ico",
|
|
"--log-level", "WARN",
|
|
"--name", "stb-gui",
|
|
"--onefile",
|
|
"--paths", f"./src{os.pathsep}/c/Qt/{QT_VERSION_STR}", # if missing dlls the extra qt folder might be wrong
|
|
"--python-option", "-u -O",
|
|
# "--specpath", ".", # breaks data paths making them relative from specpath
|
|
"--windowed",
|
|
"--workpath", "./build",
|
|
"-y",
|
|
"./src/main.py",
|
|
] + [
|
|
"--collect-binaries", "can",
|
|
"--collect-submodules", "can",
|
|
]
|
|
|
|
included_data = [
|
|
f"./src/ui/imgs{os.pathsep}ui/imgs",
|
|
]
|
|
|
|
for root, dirnames, filenames in os.walk(os.path.join("src", "ui")):
|
|
for filename in filenames:
|
|
if filename.endswith(".ui") or filename.endswith(".qml"):
|
|
path = os.path.join(root, filename)
|
|
dest = path.split(os.sep)[1:-1]
|
|
if not len(dest):
|
|
dest = ["."]
|
|
dest = os.path.join(*dest)
|
|
included_data.append(f"{path}{os.pathsep}{dest}")
|
|
|
|
for spec in included_data:
|
|
args.append("--add-data")
|
|
args.append(spec)
|
|
|
|
PyInstaller.__main__.run(args)
|