452862e0f3
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
72 lines
4.2 KiB
PowerShell
72 lines
4.2 KiB
PowerShell
<#
|
|
Cosa fa: avvia TieMeasureFlow DA SORGENTE su una macchina di sviluppo Windows, senza la build
|
|
Nuitka (che richiede ~20 minuti): stessi quattro server e stesse porte dell'exe (8780 web,
|
|
8000 backend, 8100 visione, 8765 camera), stessa cartella dati %PROGRAMDATA%\Tielogic\TieMeasureFlow.
|
|
Prima dell'avvio: ambiente Python 3.13 in build\venv313 (uv sync, solo con -Sincronizza o se manca),
|
|
tailwind.css e traduzioni .mo ricompilati, DLL di WeasyPrint in build\gtk (scaricate con
|
|
pdf\prendi-gtk.ps1 se mancano). Scrive vision-engine-version.txt nella radice (sha del submodule
|
|
vendor/visionsuite) se git c'e'; senza git e senza il file si ferma con un errore chiaro (#109).
|
|
|
|
Come si usa (dalla radice del repo):
|
|
powershell -ExecutionPolicy Bypass -File packaging\windows\sviluppo.ps1 [-Sincronizza] [-Ascolto 0.0.0.0] [-EscludiCamere OECS]
|
|
Dopo una modifica: Ctrl+C e rilancio (pochi secondi). Template e JS non richiedono altro;
|
|
classi Tailwind nuove e msgid nuovi vengono ricompilati a ogni avvio.
|
|
|
|
Dipende da: uv, npx (Node), git (opzionale: senza, serve vision-engine-version.txt gia' nella radice), la licenza tiemeasureflow di QUESTA macchina in
|
|
%PROGRAMDATA%\Tielogic\licenze\tiemeasureflow.json (impronta: avvio.py --impronta).
|
|
#>
|
|
param(
|
|
[switch]$Sincronizza, # forza uv sync (dipendenze cambiate)
|
|
[string]$Ascolto = '127.0.0.1', # indirizzo di ascolto della UI web ($Host e' riservato in PowerShell)
|
|
[string]$EscludiCamere = '' # backend nativi da saltare (TieVision-Core#339): OECS se c'e' il runtime OECS ma in fiera si usa GenTL
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$radice = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
|
$env:UV_PROJECT_ENVIRONMENT = Join-Path $radice 'build\venv313' # stesso ambiente della build
|
|
$py = Join-Path $env:UV_PROJECT_ENVIRONMENT 'Scripts\python.exe'
|
|
|
|
if ($Sincronizza -or -not (Test-Path $py)) {
|
|
uv sync --python 3.13 --frozen --extra server --extra client --extra vision-worker --group windows
|
|
if ($LASTEXITCODE -ne 0) { throw "uv sync fallito" }
|
|
}
|
|
|
|
# CSS e traduzioni: non sono nel repo, come in build.ps1
|
|
$flask = Join-Path $radice 'src\frontend\flask_app'
|
|
Push-Location $flask
|
|
try {
|
|
npx --yes tailwindcss@3.4.19 -i static/css/input.css -o static/css/tailwind.css --minify
|
|
if ($LASTEXITCODE -ne 0) { throw "Tailwind fallito" }
|
|
& (Join-Path $env:UV_PROJECT_ENVIRONMENT 'Scripts\pybabel.exe') -q compile -d translations
|
|
if ($LASTEXITCODE -ne 0) { throw "pybabel compile fallito" }
|
|
} finally { Pop-Location }
|
|
|
|
# DLL di WeasyPrint fuori dalla radice (gtk\ nella radice non e' ignorata da git): build\gtk
|
|
$gtk = Join-Path $radice 'build\gtk'
|
|
if (-not (Test-Path (Join-Path $gtk '*.dll'))) {
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'pdf\prendi-gtk.ps1') -Destinazione $gtk
|
|
if ($LASTEXITCODE -ne 0) { throw "prendi-gtk.ps1 fallito" }
|
|
}
|
|
$env:WEASYPRINT_DLL_DIRECTORIES = $gtk
|
|
|
|
# #109: il worker di visione rifiuta ogni job senza VISION_ENGINE_VERSION, che avvio.py legge da
|
|
# <radice>\vision-engine-version.txt (come nel pacchetto, build.ps1). Da sorgente lo scrive questo script.
|
|
$versione = Join-Path $radice 'vision-engine-version.txt'
|
|
$shaMotore = $null
|
|
if (Get-Command git -ErrorAction SilentlyContinue) {
|
|
$shaMotore = (git -C (Join-Path $radice 'vendor\visionsuite') rev-parse HEAD 2>$null)
|
|
if ($LASTEXITCODE -ne 0) { $shaMotore = $null }
|
|
}
|
|
if ($shaMotore) {
|
|
# 40 caratteri ASCII, UTF8 senza BOM e senza a capo (avvio.py fa .strip(), che non toglie il BOM)
|
|
[System.IO.File]::WriteAllText($versione, $shaMotore.Trim(), (New-Object System.Text.UTF8Encoding $false))
|
|
} elseif (Test-Path $versione) {
|
|
Write-Host "git non disponibile: uso $versione = $((Get-Content -Raw $versione).Trim())"
|
|
} else {
|
|
throw "Manca vision-engine-version.txt e git non puo' leggere vendor\visionsuite. Rimedio: crea l'archivio con 'uv run python scripts/archivio_sorgente.py --out tmf.zip' da un clone con git, oppure scrivi in $versione lo sha del submodule (40 caratteri, ASCII, senza BOM e senza a capo)."
|
|
}
|
|
|
|
if ($EscludiCamere) { $env:VS_CAMERA_ESCLUDI = $EscludiCamere } # #339: stesso percorso camera del PC fiera
|
|
Set-Location $radice
|
|
& $py (Join-Path $PSScriptRoot 'avvio.py') --senza-browser --senza-finestre --host $Ascolto # errori in console, niente MessageBox
|
|
exit $LASTEXITCODE
|