feat: 增加伴生包加载器、manifest配置,Excel处理优化
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""插件运行期依赖清单。
|
||||
|
||||
这是唯一的事实源:
|
||||
- build_pyd.py 读 COMPANION_PACKAGES_PYD 决定要编哪些伴生包;
|
||||
- build_pyd.py 编译 mil 时用 --include-package 把 COMPANION_PACKAGES_INLINE 编进 mil.pyd;
|
||||
- tools/export_runtime.py 读 COMPANION_C_EXTENSIONS 决定要拷哪些 C 扩展。
|
||||
|
||||
加新伴生包时只动这里,其它脚本自动跟随。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
# 需 Nuitka 编译成独立 .pyd 的伴生包(业务代码需保护)
|
||||
COMPANION_PACKAGES_PYD: list[str] = []
|
||||
|
||||
# 编译 mil 时用 --include-package 编进 mil.pyd 的纯 Python 包
|
||||
# 这些包的 .py 代码编进 mil.pyd,运行时内部 hard-import,不查 sys.path
|
||||
COMPANION_PACKAGES_INLINE: list[str] = [
|
||||
"openpyxl",
|
||||
"et_xmlfile",
|
||||
]
|
||||
|
||||
# 编译 mil 时用 --include-module 编进 mil.pyd 的 stdlib 子模块
|
||||
# Nuitka 默认不编译 stdlib(--nofollow-stdlib),所以必须显式 include。
|
||||
# 这些是 openpyxl/et_xmlfile 间接依赖的纯 Python stdlib,编进 mil.pyd 后
|
||||
# 运行时 hard-import,不查 sys.path。只有 C 扩展(_elementtree)留给运行时。
|
||||
COMPANION_STDLIB_INLINE: list[str] = [
|
||||
"xml.etree",
|
||||
"xml.etree.ElementTree",
|
||||
"xml.etree.ElementPath",
|
||||
"xml.etree.ElementInclude",
|
||||
]
|
||||
|
||||
# 兼容旧接口:所有伴生包
|
||||
COMPANION_PACKAGES: list[str] = COMPANION_PACKAGES_PYD + COMPANION_PACKAGES_INLINE
|
||||
|
||||
# 插件依赖的 C 扩展模块(Nuitka --module 编不进去,运行时从插件目录加载)
|
||||
# key = 所属 stdlib 包名, value = C 扩展模块名列表
|
||||
COMPANION_C_EXTENSIONS: dict[str, list[str]] = {
|
||||
"xml": ["_elementtree"], # xml.etree.ElementTree 内部 from _elementtree import *
|
||||
}
|
||||
Reference in New Issue
Block a user