YREA-SLS/SLS_Python/sls_build_backend/_version_dev.py.in

18 lines
505 B
Python

import subprocess
from datetime import datetime, timezone
__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()
version = "{version}"
commit = __result_hash + " " + __result_date
timestamp = datetime.now(timezone.utc).isoformat() + "Z"