#!/bin/bash # Shell脚本 - 构建Python Core # 用于Linux/macOS环境下构建Python可执行文件 set -e # 遇到错误时退出 echo "🚀 Building MixVideo V2 Python Core for $(uname)..." # 检查Python是否安装 if ! command -v python3 &> /dev/null; then if ! command -v python &> /dev/null; then echo "❌ Python is not installed or not in PATH" echo "Please install Python 3.8+ and add it to PATH" exit 1 else PYTHON_CMD="python" fi else PYTHON_CMD="python3" fi echo "✅ Using Python: $PYTHON_CMD" # 检查Python版本 PYTHON_VERSION=$($PYTHON_CMD --version 2>&1 | cut -d' ' -f2) echo "Python version: $PYTHON_VERSION" # 检查pip是否可用 if ! $PYTHON_CMD -m pip --version &> /dev/null; then echo "❌ pip is not available" echo "Please ensure pip is installed with Python" exit 1 fi echo "✅ Python environment check passed" # 切换到项目根目录 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" cd "$PROJECT_ROOT" echo "📁 Working directory: $PROJECT_ROOT" # 运行Python构建脚本 echo "📦 Running Python build script..." $PYTHON_CMD scripts/build_python_core.py echo "✅ Build completed successfully!" echo "" echo "📋 Next steps:" echo "1. Test the build: cargo tauri dev" echo "2. Build the app: cargo tauri build" echo ""