Permet de distribuer l'application en executable Windows double-clic, sans Python/Node/terminal pour l'utilisateur final. - `desktop.py` : demarre le serveur sur un port libre dans un thread et ouvre une fenetre native (pywebview). `PLESNA_DEBUG=1` active les DevTools. Commande `plesna-gerance desktop` (import paresseux). - `paths.py` : resolution centralisee des chemins selon le contexte (dev, executable PyInstaller, surcharge par variables d'env). Les donnees vont dans un dossier utilisateur inscriptible (%APPDATA%), les ressources dans le bundle. connection.py/storage.py utilisent `get_data_dir()`, app.py `resource_path()`. - app.py : type MIME `.mjs` force (modules ES / worker PDF.js sous Windows). - Groupes de deps optionnels desktop / desktop-linux / build. - packaging/ : spec PyInstaller, build_windows.ps1, installeur Inno Setup. Workflow GitHub build-windows.yml (runner Windows). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
54 lines
2.0 KiB
PowerShell
54 lines
2.0 KiB
PowerShell
# Build de l'application Windows autonome (Plesna Gérance).
|
|
#
|
|
# À lancer depuis la racine du projet, dans PowerShell, sur une machine Windows :
|
|
#
|
|
# powershell -ExecutionPolicy Bypass -File packaging\build_windows.ps1
|
|
#
|
|
# Prérequis sur la machine de build (PAS sur la machine de l'utilisateur final) :
|
|
# - Python >= 3.10 et uv (https://docs.astral.sh/uv/)
|
|
# - Node.js >= 22 (pour builder le frontend)
|
|
# - (optionnel) Inno Setup 6 pour produire l'installeur .exe
|
|
#
|
|
# Résultat :
|
|
# dist\PlesnaGerance.exe (exécutable autonome)
|
|
# dist\PlesnaGerance-Setup.exe (installeur, si Inno Setup présent)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $Root
|
|
|
|
Write-Host "==> 1/4 Build du frontend" -ForegroundColor Cyan
|
|
Set-Location (Join-Path $Root "frontend")
|
|
npm ci
|
|
npm run build
|
|
Set-Location $Root
|
|
|
|
Write-Host "==> 2/4 Installation des dependances Python (desktop + build)" -ForegroundColor Cyan
|
|
uv sync --group desktop --group build
|
|
|
|
Write-Host "==> 3/4 Empaquetage PyInstaller" -ForegroundColor Cyan
|
|
uv run pyinstaller packaging\plesna_gerance.spec --noconfirm --clean
|
|
|
|
$Exe = Join-Path $Root "dist\PlesnaGerance.exe"
|
|
if (-not (Test-Path $Exe)) {
|
|
throw "Echec : $Exe introuvable."
|
|
}
|
|
Write-Host " OK -> $Exe" -ForegroundColor Green
|
|
|
|
Write-Host "==> 4/4 Construction de l'installeur (Inno Setup)" -ForegroundColor Cyan
|
|
$IsccCandidates = @(
|
|
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
|
|
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe"
|
|
)
|
|
$Iscc = $IsccCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
|
|
|
|
if ($Iscc) {
|
|
& $Iscc "packaging\installer.iss"
|
|
Write-Host " OK -> dist\PlesnaGerance-Setup.exe" -ForegroundColor Green
|
|
} else {
|
|
Write-Host " Inno Setup non trouve : etape installeur ignoree." -ForegroundColor Yellow
|
|
Write-Host " (L'executable dist\PlesnaGerance.exe est utilisable tel quel.)" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host "`nTermine." -ForegroundColor Green
|