build: purge torch venv GUI V6 + précache OnnxTR + version release unifiée (P0-3/P0-4/P1-7)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -266,6 +266,11 @@ Require-Path -PathValue $VenvPython -Label "Python du venv"
|
||||
|
||||
Push-Location $ProjectRoot
|
||||
try {
|
||||
# P1-7 (Plan 3) : version release unique, réutilisée par build_info.py,
|
||||
# gui_v6/_build_version.py et l'installeur Inno Setup (/DAppVersion).
|
||||
$ReleaseVersion = (Get-Date -Format "yyyy.MM.dd.HHmm")
|
||||
Write-Host "Version release : $ReleaseVersion"
|
||||
|
||||
Write-Step "Installation des dépendances de build"
|
||||
& $VenvPython -m pip install --upgrade pip setuptools wheel
|
||||
if (-not $SkipRequirements) {
|
||||
@@ -273,6 +278,28 @@ try {
|
||||
}
|
||||
& $VenvPython -m pip install pyinstaller
|
||||
|
||||
if ($GuiV6) {
|
||||
Write-Step "Purge torch/optimum du venv de build (P0-3, GUI V6 torch-free)"
|
||||
# optimum[onnxruntime] (requirements.txt) tire torch en dépendance cœur ;
|
||||
# la GUI V6 ne l'utilise jamais (NER = onnxruntime brut, OCR = OnnxTR).
|
||||
# La spec legacy V5 garde torch : purge limitée au flavor GUI V6.
|
||||
& $VenvPython -m pip uninstall -y torch torchvision optimum 2>$null
|
||||
& $VenvPython -c "import importlib.util,sys; sys.exit(1 if importlib.util.find_spec('torch') else 0)"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "torch encore importable dans le venv de build : purge P0-3 échouée."
|
||||
}
|
||||
Write-Host "Venv de build torch-free : OK"
|
||||
}
|
||||
|
||||
Write-Step "Précache des poids OnnxTR (P0-4)"
|
||||
# La spec PyInstaller raise FileNotFoundError si db_resnet50/crnn_vgg16_bn
|
||||
# sont absents du cache : on les télécharge explicitement au lieu de
|
||||
# dépendre du cache résiduel de la machine.
|
||||
& $VenvPython -c "from onnxtr.models import ocr_predictor; ocr_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn'); print('Poids OnnxTR en cache : OK')"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Précache OnnxTR échoué (réseau ? proxy ?) : le build frozen échouerait sur les poids manquants."
|
||||
}
|
||||
|
||||
Write-Step "Génération de build_info.py"
|
||||
$commit = "local"
|
||||
$branch = "local"
|
||||
@@ -291,10 +318,21 @@ BUILD_DATE = "$buildDate"
|
||||
BUILD_COMMIT = "$commit"
|
||||
BUILD_BRANCH = "$branch"
|
||||
BUILD_FLAVOR = "$BuildFlavor"
|
||||
BUILD_VERSION = "$ReleaseVersion"
|
||||
"@
|
||||
Set-Content -Path $BuildInfoPath -Value $buildInfo -Encoding UTF8
|
||||
Write-Host "Build info : $buildDate / $branch / $commit"
|
||||
|
||||
if ($GuiV6) {
|
||||
$BuildVersionPath = Join-Path $ProjectRoot "gui_v6\_build_version.py"
|
||||
$buildVersionContent = @"
|
||||
"""Version release - généré automatiquement par build_windows_oneclick.ps1 (P1-7)."""
|
||||
BUILD_VERSION = "$ReleaseVersion"
|
||||
"@
|
||||
Set-Content -Path $BuildVersionPath -Value $buildVersionContent -Encoding UTF8
|
||||
Write-Host "gui_v6/_build_version.py : $ReleaseVersion"
|
||||
}
|
||||
|
||||
Write-Step "Nettoyage des anciens artefacts"
|
||||
foreach ($PathValue in @($BuildDir, $DistDir, $PackageDir)) {
|
||||
if (Test-Path $PathValue) {
|
||||
@@ -367,8 +405,7 @@ Build :
|
||||
$innoCompiler = Resolve-InnoCompiler
|
||||
if ($innoCompiler) {
|
||||
Write-Host "Inno Setup Compiler : $innoCompiler"
|
||||
$installerVersion = (Get-Date -Format "yyyy.MM.dd.HHmm")
|
||||
& $innoCompiler "/DAppVersion=$installerVersion" $InstallerScriptPath
|
||||
& $innoCompiler "/DAppVersion=$ReleaseVersion" $InstallerScriptPath
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Inno Setup a échoué avec le code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user