#!/bin/bash set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" PYTHON="$ROOT/.build-tools/bin/python" if [ ! -x "$PYTHON" ]; then echo "请先使用 Python 3.12 创建 .build-tools 虚拟环境并安装 native-engine/requirements.txt。" >&2 exit 1 fi export PYINSTALLER_CONFIG_DIR="$ROOT/.build-tools/pyinstaller-cache" cd "$ROOT/native-engine" "$PYTHON" -m PyInstaller --noconfirm --clean --onedir --windowed --name receipt-engine-helper \ --osx-bundle-identifier test.reimburse.engine \ --distpath "$ROOT/native-engine/dist" --workpath "$ROOT/native-engine/build" \ --collect-all rapidocr_onnxruntime --collect-all onnxruntime \ --collect-all pypdfium2 --collect-all pypdfium2_raw \ --add-data "personal-expense-template.xlsx:." engine.py echo "本地处理引擎已打包,可以在 Xcode 中运行 reimburse。"