feat: 分发包改为字节码,并补上 MuMu 探测和下载列表滚动
This commit is contained in:
@@ -180,6 +180,37 @@ def copy_server(stage: Path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def hide_server_source(stage: Path) -> None:
|
||||
server = stage / "server"
|
||||
python = stage / "runtime" / "python" / "python.exe"
|
||||
if not python.is_file():
|
||||
raise SystemExit("还没有内置 Python,不能编译服务端")
|
||||
run(
|
||||
[
|
||||
str(python),
|
||||
"-m",
|
||||
"compileall",
|
||||
"-b",
|
||||
"-q",
|
||||
"-s",
|
||||
str(server),
|
||||
"-p",
|
||||
"server",
|
||||
str(server),
|
||||
],
|
||||
server,
|
||||
)
|
||||
for path in server.rglob("*.py"):
|
||||
path.unlink()
|
||||
for path in list(server.rglob("__pycache__")):
|
||||
if path.is_dir():
|
||||
shutil.rmtree(path)
|
||||
if any(server.rglob("*.py")):
|
||||
raise SystemExit("服务端源码没有从分发包里去掉")
|
||||
if not any(server.rglob("*.pyc")):
|
||||
raise SystemExit("服务端没有编译出字节码")
|
||||
|
||||
|
||||
def make_zip(stage: Path) -> Path:
|
||||
suffix = "windows-x64" if sys.platform == "win32" else platform.system().lower()
|
||||
archive = DIST / f"{STAGE_NAME}-{suffix}.zip"
|
||||
@@ -220,6 +251,7 @@ def main() -> None:
|
||||
ui_dest = stage / "dist" / "ui"
|
||||
shutil.copytree(DIST / "ui", ui_dest)
|
||||
bundle_python(stage)
|
||||
hide_server_source(stage)
|
||||
bundle_adb(stage)
|
||||
bundle_ffmpeg(stage)
|
||||
bundle_webview(stage)
|
||||
|
||||
Reference in New Issue
Block a user