fix: build_backend.py Windows unicode + conditional data dir

- Replace emoji prints with ASCII to avoid cp1252 UnicodeEncodeError on Windows
- Make data/ directory in PyInstaller spec conditional (skip if not present in CI)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
周小舟
2026-05-28 15:03:22 +08:00
parent 43dd7c997c
commit 762a2f1370

View File

@@ -19,16 +19,16 @@ def main():
)
args = parser.parse_args()
print("🔧 开始构建桌面版后端...")
print("[BUILD] Starting desktop backend build...")
# 设置路径
project_root = Path(__file__).parent.parent
backend_dir = project_root / "backend"
resources_dir = project_root / "src-tauri" / "resources"
# 确保资源目录存在
resources_dir.mkdir(parents=True, exist_ok=True)
# 检查虚拟环境(本地开发)或使用当前 PythonCI
venv_path = project_root / "venv"
if venv_path.exists():
@@ -39,7 +39,7 @@ def main():
pip_path = sys.executable
python_path = sys.executable
# 将 pip install 改为 python -m pip
print("⚠️ 未检测到 venv使用当前 Python 环境")
print("[BUILD] No venv detected, using current Python environment")
if args.install_deps:
# 安装依赖