import subprocess from datetime import datetime, timezone version = "{version}" try: __result_hash = subprocess.check_output( ["git", "describe", "--always", "--dirty", "--abbrev=7"], cwd=".", stderr=subprocess.DEVNULL, text=True ).strip() __result_date = subprocess.check_output( ["git", "show", "-s", "--format=%ci"], cwd=".", stderr=subprocess.DEVNULL, text=True ).strip() commit = __result_hash + " " + __result_date except: commit = "unknown" try: timestamp = datetime.now(timezone.utc).isoformat() + "Z" except: timestamp = "unknown"