feat(gui): afficher version + build date + commit dans titre et status bar
Demande utilisateur : pouvoir identifier la build au premier coup d'oeil
sans confondre ancien/nouveau exe lors des tests.
Implémentation :
- build_info.py (gitignored, fallback "dev" pour mode développement)
régénéré automatiquement par scripts/rebuild_anon.ps1 avec :
BUILD_DATE = "2026-04-15 18:15"
BUILD_COMMIT = "234137e"
BUILD_BRANCH = "main"
- Pseudonymisation_Gui_V5.py : fonction _version_long() qui construit
"v5.4 · 2026-04-15 18:15 · #234137e" depuis build_info (avec fallback
silencieux si module absent en dev). Affichée dans :
- Titre fenêtre : "Pseudonymisation de vos documents — v5.4 · ..."
- Status bar en bas à droite
- anonymisation_onefile.spec : build_info.py ajouté aux datas bundlées.
- scripts/rebuild_anon.ps1 : STEP 4a génère build_info.py avant le
PyInstaller avec git rev-parse short + branch + date courante.
- .gitignore : build_info.py exclu (volatile, regénéré).
En mode dev (pas frozen) : affichage "v5.4" seul (fallback).
En mode frozen : affichage complet avec date/commit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -43,6 +43,10 @@ models/
|
|||||||
# Exception : assets embarqués dans l'exe (splash, icônes…) doivent être versionnés
|
# Exception : assets embarqués dans l'exe (splash, icônes…) doivent être versionnés
|
||||||
!assets/**
|
!assets/**
|
||||||
!assets
|
!assets
|
||||||
|
|
||||||
|
# build_info.py : régénéré automatiquement par scripts/rebuild_anon.ps1
|
||||||
|
# avec date/commit/branch. Ne pas versionner.
|
||||||
|
build_info.py
|
||||||
*.mp3
|
*.mp3
|
||||||
*.wav
|
*.wav
|
||||||
*.mp4
|
*.mp4
|
||||||
|
|||||||
@@ -89,6 +89,24 @@ except ImportError:
|
|||||||
APP_TITLE = "Pseudonymisation de vos documents"
|
APP_TITLE = "Pseudonymisation de vos documents"
|
||||||
APP_VERSION = "v5.4"
|
APP_VERSION = "v5.4"
|
||||||
|
|
||||||
|
# Métadonnées de build — chargées depuis build_info.py (régénéré par rebuild_anon.ps1)
|
||||||
|
try:
|
||||||
|
from build_info import BUILD_DATE, BUILD_COMMIT, BUILD_BRANCH
|
||||||
|
except Exception:
|
||||||
|
BUILD_DATE = "dev"
|
||||||
|
BUILD_COMMIT = "dev"
|
||||||
|
BUILD_BRANCH = "dev"
|
||||||
|
|
||||||
|
|
||||||
|
def _version_long() -> str:
|
||||||
|
"""Version étendue : v5.4 · 2026-04-15 18:15 · 234137e"""
|
||||||
|
parts = [APP_VERSION]
|
||||||
|
if BUILD_DATE != "dev":
|
||||||
|
parts.append(BUILD_DATE)
|
||||||
|
if BUILD_COMMIT != "dev":
|
||||||
|
parts.append(f"#{BUILD_COMMIT}")
|
||||||
|
return " · ".join(parts)
|
||||||
|
|
||||||
def _app_dir() -> Path:
|
def _app_dir() -> Path:
|
||||||
"""Répertoire racine de l'application (compatible PyInstaller/Nuitka)."""
|
"""Répertoire racine de l'application (compatible PyInstaller/Nuitka)."""
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
@@ -283,7 +301,9 @@ class ToolTip:
|
|||||||
class App:
|
class App:
|
||||||
def __init__(self, root: tk.Tk):
|
def __init__(self, root: tk.Tk):
|
||||||
self.root = root
|
self.root = root
|
||||||
self.root.title(APP_TITLE)
|
# Titre avec version longue pour identifier la build au premier coup d'œil
|
||||||
|
# (évite les confusions entre exe ancien/nouveau lors des tests).
|
||||||
|
self.root.title(f"{APP_TITLE} — {_version_long()}")
|
||||||
self.root.geometry("780x820")
|
self.root.geometry("780x820")
|
||||||
self.root.minsize(600, 650)
|
self.root.minsize(600, 650)
|
||||||
|
|
||||||
@@ -726,7 +746,7 @@ class App:
|
|||||||
).pack(side=tk.LEFT)
|
).pack(side=tk.LEFT)
|
||||||
|
|
||||||
tk.Label(
|
tk.Label(
|
||||||
status_bar, text=APP_VERSION, font=self._f_small,
|
status_bar, text=_version_long(), font=self._f_small,
|
||||||
bg=CLR_BG, fg=CLR_TEXT_SECONDARY, anchor="e",
|
bg=CLR_BG, fg=CLR_TEXT_SECONDARY, anchor="e",
|
||||||
).pack(side=tk.RIGHT)
|
).pack(side=tk.RIGHT)
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ for data_file in [
|
|||||||
datas.append((src, 'data'))
|
datas.append((src, 'data'))
|
||||||
for pyfile in ['anonymizer_core_refactored_onnx.py', 'eds_pseudo_manager.py',
|
for pyfile in ['anonymizer_core_refactored_onnx.py', 'eds_pseudo_manager.py',
|
||||||
'gliner_manager.py', 'camembert_ner_manager.py',
|
'gliner_manager.py', 'camembert_ner_manager.py',
|
||||||
'Pseudonymisation_Gui_V5.py']:
|
'Pseudonymisation_Gui_V5.py', 'build_info.py']:
|
||||||
datas.append((os.path.join(app_dir, pyfile), '.'))
|
datas.append((os.path.join(app_dir, pyfile), '.'))
|
||||||
|
|
||||||
a = Analysis(
|
a = Analysis(
|
||||||
|
|||||||
@@ -50,6 +50,20 @@ Write-Host " Venv détecté : $venvPython"
|
|||||||
Write-Host "=== STEP 4 : Régénérer finess_numbers.txt (entjur fix) ==="
|
Write-Host "=== STEP 4 : Régénérer finess_numbers.txt (entjur fix) ==="
|
||||||
& $venvPython "$project\scripts\build_finess_gazetteers.py" 2>&1 | Out-Host
|
& $venvPython "$project\scripts\build_finess_gazetteers.py" 2>&1 | Out-Host
|
||||||
|
|
||||||
|
Write-Host "=== STEP 4a : Générer build_info.py (identifiant de build) ==="
|
||||||
|
$commit = (git rev-parse --short HEAD 2>&1).Trim()
|
||||||
|
$branch = (git rev-parse --abbrev-ref HEAD 2>&1).Trim()
|
||||||
|
$buildDate = Get-Date -Format "yyyy-MM-dd HH:mm"
|
||||||
|
$buildInfo = @"
|
||||||
|
"""Métadonnées de build - GENERE AUTOMATIQUEMENT par rebuild_anon.ps1.
|
||||||
|
Ne PAS editer a la main - ecrase a chaque rebuild."""
|
||||||
|
BUILD_DATE = "$buildDate"
|
||||||
|
BUILD_COMMIT = "$commit"
|
||||||
|
BUILD_BRANCH = "$branch"
|
||||||
|
"@
|
||||||
|
$buildInfo | Set-Content "$project\build_info.py" -Encoding UTF8
|
||||||
|
Write-Host " build_info.py: $buildDate / $commit / $branch"
|
||||||
|
|
||||||
Write-Host "=== STEP 4bis : Désactiver scan Defender sur dist/ (évite locks PyInstaller) ==="
|
Write-Host "=== STEP 4bis : Désactiver scan Defender sur dist/ (évite locks PyInstaller) ==="
|
||||||
try {
|
try {
|
||||||
Add-MpPreference -ExclusionPath "$project\dist" -ErrorAction SilentlyContinue
|
Add-MpPreference -ExclusionPath "$project\dist" -ErrorAction SilentlyContinue
|
||||||
|
|||||||
Reference in New Issue
Block a user