From c67280df44cb0db1bad3815a2938adc0904a10de Mon Sep 17 00:00:00 2001 From: VALLONGOL Date: Mon, 15 Dec 2025 08:36:25 +0100 Subject: [PATCH] =?UTF-8?q?check=20iniziale=20se=20pygount=20=C3=A8=20inst?= =?UTF-8?q?allato=20nel=20sistema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyucc/__main__.py | 20 ++++++++++++++++++++ pyucc/_version.py | 6 +++--- pyucc/gui/gui.py | 38 ++++++++++++++++++++++++++++++++++++++ todo.md | 6 +++--- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/pyucc/__main__.py b/pyucc/__main__.py index 3f2cf1b..7c14aed 100644 --- a/pyucc/__main__.py +++ b/pyucc/__main__.py @@ -145,6 +145,26 @@ def main(): args = parser.parse_args() + # Inform the user early if pygount is not available (affects comment counting) + try: + from pyucc.core import countings_impl + + if not getattr(countings_impl, "_HAS_PYGOUNT", False): + print( + "ATTENZIONE: il pacchetto 'pygount' non è disponibile. I conteggi dei commenti e le metriche estese potrebbero non essere disponibili.", + file=sys.stderr, + ) + print( + "Per risolvere: attiva la virtualenv usata per eseguire l'app e esegui 'pip install pygount'", + file=sys.stderr, + ) + print( + "Se distribuisci con PyInstaller, ricostruisci l'eseguibile includendo 'pygount' (aggiungi un hook o hiddenimports).", + file=sys.stderr, + ) + except Exception: + # Non critico: continuiamo senza interrompere l'esecuzione + pass # If user asked for GUI, or no positional directories were provided, launch GUI and exit if args.gui or len(args.baseline_dirs or []) == 0: try: diff --git a/pyucc/_version.py b/pyucc/_version.py index 84ed46b..fb6f085 100644 --- a/pyucc/_version.py +++ b/pyucc/_version.py @@ -6,10 +6,10 @@ import re # --- Version Data (Generated) --- -__version__ = "v.0.0.0.20-0-g9538919-dirty" -GIT_COMMIT_HASH = "95389193747b356fc287b149371c64ad557fcb30" +__version__ = "v.0.0.0.22-0-gea1d31b-dirty" +GIT_COMMIT_HASH = "ea1d31b82e9fa64a3bb809c001f8c465fbcb0294" GIT_BRANCH = "master" -BUILD_TIMESTAMP = "2025-12-12T09:15:00.613998+00:00" +BUILD_TIMESTAMP = "2025-12-15T07:30:39.921932+00:00" IS_GIT_REPO = True # --- Default Values (for comparison or fallback) --- diff --git a/pyucc/gui/gui.py b/pyucc/gui/gui.py index 9130cf8..a0a7b24 100644 --- a/pyucc/gui/gui.py +++ b/pyucc/gui/gui.py @@ -231,6 +231,44 @@ class App(tk.Tk): except Exception: pass + # Check if pygount is available and warn the user if not. + try: + from ..core import countings_impl + + if not getattr(countings_impl, "_HAS_PYGOUNT", False): + msg = ( + """ +Il pacchetto 'pygount' non è disponibile. + +I conteggi dei commenti e alcune metriche estese potrebbero non funzionare correttamente. + +Soluzioni possibili: + 1) Se usi l'ambiente di sviluppo: attiva la virtualenv e esegui 'pip install pygount'. + 2) Se usi l'eseguibile PyInstaller: ricostruiscilo includendo 'pygount' (hook o hiddenimports). + 3) Per controllare rapidamente: esegui + python -c 'from pyucc.core import countings_impl; print(countings_impl._HAS_PYGOUNT)' +""" + ) + try: + messagebox.showwarning("Dipendenza mancante: pygount", msg) + except Exception: + # If messagebox fails (headless), fallback to logging + pass + try: + self.log( + "pygount non disponibile: conteggio commenti e metriche estese disabilitate", + level="WARNING", + ) + except Exception: + pass + try: + self.phase_var.set("Ready (pygount missing — limited functionality)") + except Exception: + pass + except Exception: + # ignore any unexpected error when checking for pygount + pass + # small helper: expose a convenient log method that forwards to # the standard logging system so messages flow through the queue. def log(self, msg: str, level: str = "INFO"): diff --git a/todo.md b/todo.md index c6d7e97..745a7b0 100644 --- a/todo.md +++ b/todo.md @@ -29,7 +29,7 @@ - [x] salvare il file delle diff in automatico - [x] mettere le hint per spiegare i vari parametri cosa sono - [x] ordinare le righe selezionando la colonna sia in ordine screscente che descrescente -- [ ] aggiornare profilo percorso quando premo su salva +- [x] aggiornare profilo percorso quando premo su salva - [x] non perdere la selezione sulle estensioni quando modifico il profilo -- [ ] verificare con dsp 10 e 11 le differenze con quelle di UCC intorno ai 70000 linee di codice 708 linee di codice modificato -- [ ] verificare se i commenti vengo conteggiati oppure no, nei file c++, c, h ecc +- [x] verificare con dsp 10 e 11 le differenze con quelle di UCC intorno ai 70000 linee di codice 708 linee di codice modificato +- [x] verificare se i commenti vengo conteggiati oppure no, nei file c++, c, h ecc