docs: 完善README文档与架构图,修复全量注释与日志问题
- README: 补充项目概述、技术栈、架构图(Mermaid)、插件生命周期时序图 - build.py: 补充模块和函数 docstring - core/__init__.py: 修正模块说明(工具箱→插件系统) - log.py: 修复过时注释,清理死代码,抑制第三方库日志刷屏 - plugin_registry.py: 修正矛盾注释,补充缺失日志,隐藏远程路径 - plugins.py: 修正过时注释,清理死代码和无用导入 - plugins_card.py: 修正错误类名注释,补充全量 docstring - main.py: 修正错误注释,补充启动/退出/插件加载日志
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
"""Nuitka 打包构建脚本。
|
||||
|
||||
将 main.py 编译为 Windows 独立可执行文件,并打包为便携式 zip。
|
||||
需要安装 Nuitka 和 mingw64 编译器。
|
||||
|
||||
用法:
|
||||
python build.py
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
@@ -8,15 +16,25 @@ from zipfile import ZIP_DEFLATED, ZipFile
|
||||
|
||||
from main import APP_NAME, APP_VERSION
|
||||
|
||||
# 编译器选择
|
||||
COMPILER = "mingw64"
|
||||
|
||||
# 输出路径
|
||||
OUTPUT_PATH = Path('output')
|
||||
RESOURCES_PATH = Path("resources")
|
||||
RELEASE_PATH = OUTPUT_PATH / APP_NAME
|
||||
|
||||
BUILD_PATH = OUTPUT_PATH / f'{platform.system().lower()}-{platform.machine().lower()}'
|
||||
|
||||
|
||||
def build_main():
|
||||
"""使用 Nuitka 编译 main.py 为独立可执行文件。
|
||||
|
||||
编译选项:
|
||||
- --standalone:不依赖本地 Python 环境
|
||||
- --plugin-enable=pyside6:启用 PySide6 支持
|
||||
- --include-module=runtime_hook:将启动钩子编入 exe
|
||||
- --windows-console-mode=disable:不显示控制台窗口
|
||||
"""
|
||||
nuitka_cmd = [
|
||||
sys.executable,
|
||||
'-m',
|
||||
@@ -26,10 +44,6 @@ def build_main():
|
||||
'--show-progress',
|
||||
'--plugin-enable=pyside6',
|
||||
'--include-module=qt_material',
|
||||
# 把插件 SDK 的 runtime_hook 编进 exe,启动时把 plugins/*/ 加进 sys.path。
|
||||
# Nuitka 无 --runtime-hook 选项,用 --include-module + main.py 顶部 import 替代。
|
||||
# 宿主不需要预知插件依赖哪些 stdlib——纯 Python 依赖编进 mil.pyd,
|
||||
# C 扩展由插件自带,runtime_hook 把 plugins/*/ 加进 sys.path 后能加载。
|
||||
'--include-module=runtime_hook',
|
||||
f"--include-data-dir={RESOURCES_PATH}=resources",
|
||||
]
|
||||
@@ -54,6 +68,7 @@ def build_main():
|
||||
|
||||
|
||||
def create_zip():
|
||||
"""将 Nuitka 编译产物打包为便携式 zip 文件。"""
|
||||
file_list = glob.glob(f'{BUILD_PATH / APP_NAME / "dist"}', recursive=True)
|
||||
file_list.sort()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user