- 重命名 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>
26 lines
756 B
Python
26 lines
756 B
Python
import sys
|
|
import json
|
|
|
|
def main():
|
|
for line in sys.stdin:
|
|
line = line.strip()
|
|
if not line:
|
|
continue
|
|
try:
|
|
req = json.loads(line)
|
|
action = req.get("action")
|
|
if action == "parse_template":
|
|
from xl_parser import parse_template
|
|
result = parse_template(req["file_path"])
|
|
elif action == "generate":
|
|
from generator import generate
|
|
result = generate(req)
|
|
else:
|
|
result = {"error": f"unknown action: {action}"}
|
|
except Exception as e:
|
|
result = {"error": str(e)}
|
|
print(json.dumps(result, ensure_ascii=False), flush=True)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|