Files

47 lines
1.0 KiB
Python

"""把后端冻成目录形式,供安装包直接启动,不在第一次打开时解压。"""
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
DIST = ROOT / "build"
def main() -> None:
DIST.mkdir(parents=True, exist_ok=True)
subprocess.check_call(
[
sys.executable,
"-m",
"PyInstaller",
"--noconfirm",
"--clean",
"--onedir",
"--name",
"nqi-backend",
"--distpath",
str(DIST),
"--workpath",
str(DIST / "pyinstaller"),
"--specpath",
str(DIST),
"--collect-submodules",
"app",
"--collect-all",
"uvicorn",
"--collect-all",
"cryptography",
"--collect-all",
"certifi",
"--hidden-import",
"multipart",
str(ROOT / "nqi_backend.py"),
],
cwd=ROOT,
)
if __name__ == "__main__":
main()