添加 macOS 安装包打包支持

- 重命名 parser.py → xl_parser.py 避免与 Python 3.9 stdlib 命名冲突
- 添加 PyInstaller spec 文件用于构建独立 Python 可执行文件
- 配置 electron-builder:extraResources 打包 Python binary、asarUnpack better-sqlite3
- 新增 build:python 和 dist 脚本,一键生成 DMG 安装包
- 更新测试:对齐新 fixture 结构和重命名后的模块

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MikiVL
2026-05-05 19:44:01 +08:00
co-authored by Claude Sonnet 4.6
parent 9738d2cd67
commit 70a56ede36
5 changed files with 95 additions and 11 deletions
+7 -8
View File
@@ -1,7 +1,7 @@
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../python"))
from parser import parse_template
from xl_parser import parse_template
FIXTURE = os.path.join(os.path.dirname(__file__), "../fixtures/sample_template.xlsx")
@@ -25,13 +25,12 @@ def test_placeholder_has_cell_info():
result = parse_template(FIXTURE)
biaohao = next(p for p in result["placeholders"] if p["name"] == "编号")
assert biaohao["sheet"] == "Sheet1"
assert biaohao["cell"] == "B3"
assert biaohao["cell"] == "A2"
def test_multiple_placeholders_in_one_cell():
def test_multiple_placeholders_detected():
result = parse_template(FIXTURE)
names = [p["name"] for p in result["placeholders"]]
assert "客户名" in names
assert "编号" in names # 已在其他地方存在,但也在 E9 中
# 验证 E9 中的两个占位符都被检测到
e9_placeholders = [p for p in result["placeholders"] if p["cell"] == "E9"]
assert len(e9_placeholders) == 2
assert "编号" in names
assert "姓名" in names
assert "部门" in names
assert "日期" in names