CI / lint (push) Successful in 24s
CI / security (push) Successful in 15s
CI / test (push) Successful in 29s
CI / build (push) Successful in 7s
CI / e2e (push) Failing after 23s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
Évite 'os error 32' quand Tauri essaie de lire python-embed/ pour le bundle alors que le processus Python du run précédent verrouille les .pyd
78 lines
3.4 KiB
Batchfile
78 lines
3.4 KiB
Batchfile
@echo off
|
|
REM ============================================================
|
|
REM ObsiGate Desktop — Build Windows (.msi + .exe)
|
|
REM Prérequis : Rust, Tauri CLI, NSIS, Python 3.11 embed
|
|
REM ============================================================
|
|
setlocal enabledelayedexpansion
|
|
|
|
echo ========================================
|
|
echo ObsiGate Desktop — Build Windows
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM ── 0. Kill any leftover backend from a previous run ──────────
|
|
echo [0/5] Killing leftover Python processes...
|
|
taskkill /F /IM python.exe 2>nul
|
|
echo.
|
|
|
|
REM ── 1. Vérifier les prérequis ─────────────────────────────────
|
|
echo [1/5] Verifying prerequisites...
|
|
where cargo >nul 2>&1 || (echo ❌ Rust/Cargo not found. Install from https://rustup.rs & exit /b 1)
|
|
where tauri >nul 2>&1 || cargo install tauri-cli
|
|
echo ✅ Rust + Tauri OK
|
|
|
|
REM ── 2. Préparer Python 3.11 embed ─────────────────────────────
|
|
echo [2/5] Preparing Python embed...
|
|
echo 📥 Downloading Python 3.11 embed...
|
|
if exist "python-embed" rmdir /s /q "python-embed"
|
|
curl -L -o python-embed.zip "https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip"
|
|
powershell Expand-Archive -Path python-embed.zip -DestinationPath python-embed\
|
|
del python-embed.zip
|
|
|
|
REM Enable pip and site-packages in embedded Python
|
|
echo import site >> python-embed\python311._pth
|
|
|
|
REM Add parent dir to Python path so 'import backend' works at runtime (for bundle)
|
|
echo ..>> python-embed\python311._pth
|
|
|
|
REM Download get-pip.py (embed Python doesn't include ensurepip)
|
|
echo 📥 Downloading get-pip.py...
|
|
curl -L -o get-pip.py "https://bootstrap.pypa.io/get-pip.py"
|
|
python-embed\python.exe get-pip.py --no-cache-dir
|
|
del get-pip.py
|
|
|
|
REM Install dependencies
|
|
python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt
|
|
echo ✅ Python embed ready
|
|
|
|
REM ── 3. Build Tauri ────────────────────────────────────────────
|
|
echo [3/5] Building Tauri application...
|
|
cargo tauri build --target x86_64-pc-windows-msvc --bundles msi,nsis
|
|
if errorlevel 1 (
|
|
echo ❌ Build failed!
|
|
exit /b 1
|
|
)
|
|
echo ✅ Build successful
|
|
|
|
REM ── 4. Copier le runtime à côté de l'exécutable ───────────────
|
|
echo [4/5] Copying runtime to output dir...
|
|
set "OUTDIR=target\x86_64-pc-windows-msvc\release"
|
|
if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" 2>nul
|
|
if exist "%OUTDIR%\backend" rmdir /s /q "%OUTDIR%\backend" 2>nul
|
|
if exist "%OUTDIR%\frontend" rmdir /s /q "%OUTDIR%\frontend" 2>nul
|
|
xcopy /E /I /Q /Y "python-embed" "%OUTDIR%\python-embed"
|
|
xcopy /E /I /Q /Y "..\backend" "%OUTDIR%\backend"
|
|
xcopy /E /I /Q /Y "..\frontend" "%OUTDIR%\frontend"
|
|
|
|
REM Add parent directory to Python path so 'import backend' works at runtime
|
|
echo ..>> "%OUTDIR%\python-embed\python311._pth"
|
|
echo ✅ Runtime + frontend copied + sys.path fixed
|
|
|
|
REM ── 5. Résultats ───────────────────────────────────────────────
|
|
echo [5/5] Results:
|
|
dir /b "%OUTDIR%\bundle\msi\*.msi" 2>nul
|
|
dir /b "%OUTDIR%\bundle\nsis\*.exe" 2>nul
|
|
echo.
|
|
echo ✅ Done! Check %OUTDIR%\bundle\
|
|
endlocal
|