modificata per renderla eseguibile

This commit is contained in:
VALLONGOL 2025-11-27 16:01:57 +01:00
parent f92bd09596
commit ef67abe3f0
2 changed files with 19 additions and 30 deletions

View File

@ -5,7 +5,7 @@ import json
import sys
from pathlib import Path
from .core.differ import BaselineManager, Differ
from pyucc.core.differ import BaselineManager, Differ
def main():
@ -114,7 +114,7 @@ def main():
# 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:
from .gui.gui import run_app
from pyucc.gui.gui import run_app
except Exception as e:
print(f"Errore avviando la GUI: {e}", file=sys.stderr)
sys.exit(1)

View File

@ -6,10 +6,10 @@
import re
# --- Version Data (Generated) ---
__version__ = "v.0.0.0.11-0-g7e0435a-dirty"
GIT_COMMIT_HASH = "7e0435ab7d0316bd2bcf5fdcd33cb84c39efa09c"
__version__ = "v.0.0.0.12-0-gf92bd09-dirty"
GIT_COMMIT_HASH = "f92bd09596ffc523e698f344b297c50d52dc82b4"
GIT_BRANCH = "master"
BUILD_TIMESTAMP = "2025-11-27T12:49:18.815605+00:00"
BUILD_TIMESTAMP = "2025-11-27T14:58:10.880460+00:00"
IS_GIT_REPO = True
# --- Default Values (for comparison or fallback) ---
@ -17,7 +17,6 @@ DEFAULT_VERSION = "0.0.0+unknown"
DEFAULT_COMMIT = "Unknown"
DEFAULT_BRANCH = "Unknown"
# --- Helper Function ---
def get_version_string(format_string=None):
"""
@ -45,39 +44,29 @@ def get_version_string(format_string=None):
replacements = {}
try:
replacements["version"] = __version__ if __version__ else DEFAULT_VERSION
replacements["commit"] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT
replacements["commit_short"] = (
GIT_COMMIT_HASH[:7]
if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7
else DEFAULT_COMMIT
)
replacements["branch"] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH
replacements["timestamp"] = BUILD_TIMESTAMP if BUILD_TIMESTAMP else "Unknown"
replacements["timestamp_short"] = (
BUILD_TIMESTAMP.split("T")[0]
if BUILD_TIMESTAMP and "T" in BUILD_TIMESTAMP
else "Unknown"
)
replacements["is_git"] = "Git" if IS_GIT_REPO else "Unknown"
replacements["dirty"] = (
"-dirty" if __version__ and __version__.endswith("-dirty") else ""
)
replacements['version'] = __version__ if __version__ else DEFAULT_VERSION
replacements['commit'] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT
replacements['commit_short'] = GIT_COMMIT_HASH[:7] if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7 else DEFAULT_COMMIT
replacements['branch'] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH
replacements['timestamp'] = BUILD_TIMESTAMP if BUILD_TIMESTAMP else "Unknown"
replacements['timestamp_short'] = BUILD_TIMESTAMP.split('T')[0] if BUILD_TIMESTAMP and 'T' in BUILD_TIMESTAMP else "Unknown"
replacements['is_git'] = "Git" if IS_GIT_REPO else "Unknown"
replacements['dirty'] = "-dirty" if __version__ and __version__.endswith('-dirty') else ""
tag = DEFAULT_VERSION
if __version__ and IS_GIT_REPO:
match = re.match(r"^(v?([0-9]+(?:\.[0-9]+)*))", __version__)
match = re.match(r'^(v?([0-9]+(?:\.[0-9]+)*))', __version__)
if match:
tag = match.group(1)
replacements["tag"] = tag
replacements['tag'] = tag
output_string = format_string
for placeholder, value in replacements.items():
pattern = re.compile(r"{{\s*" + re.escape(placeholder) + r"\s*}}")
output_string = pattern.sub(str(value), output_string)
pattern = re.compile(r'{{\s*' + re.escape(placeholder) + r'\s*}}')
output_string = pattern.sub(str(value), output_string)
if re.search(r"{\s*\w+\s*}", output_string):
pass # Or log a warning: print(f"Warning: Unreplaced placeholders found: {output_string}")
if re.search(r'{\s*\w+\s*}', output_string):
pass # Or log a warning: print(f"Warning: Unreplaced placeholders found: {output_string}")
return output_string