feat(installer): make Lea autonomous for POC

This commit is contained in:
Dom
2026-06-17 17:53:46 +02:00
parent 787dbfb0eb
commit 667575c3ad
5 changed files with 75 additions and 60 deletions

View File

@@ -40,34 +40,24 @@ if ($PthFile) {
}
# ---------------------------------------------------------------
# 2-3. Dependances Python
# Si l'embed est livre complet (deps + tkinter pre-embarques),
# on saute le bootstrap pip / install : INSTALL HORS-LIGNE possible.
# Sinon (embed nu), on bootstrap pip + installe requirements (mode online).
# 2-3. Verification des dependances embarquees (runtime 100% autonome)
# L'embed DOIT contenir toutes les dependances runtime.
# AUCUN pip, AUCUN reseau : si une dependance manque -> echec explicite.
# ---------------------------------------------------------------
$DepsOk = $false
& $PythonExe -c "import socketio, tkinter" 2>$null
if ($LASTEXITCODE -eq 0) { $DepsOk = $true }
if ($DepsOk) {
Write-Host " Dependances deja embarquees (socketio + tkinter) - pip saute (offline OK)."
} else {
# Bootstrap pip (necessite internet)
$GetPip = Join-Path $env:TEMP "get-pip.py"
Write-Host " Telechargement de get-pip.py..."
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile $GetPip -UseBasicParsing
Write-Host " Installation de pip..."
& $PythonExe $GetPip --no-warn-script-location
Remove-Item $GetPip -Force
$Requirements = Join-Path $AppDir "requirements_agent.txt"
if (Test-Path $Requirements) {
Write-Host " Installation des dependances Python..."
& $PythonExe -m pip install --no-warn-script-location -r $Requirements
}
$RequiredModules = @('socketio','tkinter','mss','pynput','pystray','plyer','requests','PIL','win32api')
$Missing = @()
foreach ($m in $RequiredModules) {
& $PythonExe -c "import $m" 2>$null
if ($LASTEXITCODE -ne 0) { $Missing += $m }
}
if ($Missing.Count -gt 0) {
Write-Host " ERREUR : runtime Lea incomplet. Modules manquants : $($Missing -join ', ')"
Write-Host " L'embed doit etre livre complet (aucune installation reseau en POC)."
exit 1
}
Write-Host " Dependances embarquees verifiees ($($RequiredModules.Count) modules) - offline OK."
# ---------------------------------------------------------------
# 4. Reecrire Lea.bat pour utiliser python-embed
# ---------------------------------------------------------------