libvirt/scripts/meson-timestamp.py
Han Han 28141adfdc scripts: Fix the flake8 syntax-check failures
Fix the syntax-check failures (which can be seen after
python3-flake8-import-order package is installed) with the help
of isort[1]:

289/316 libvirt:syntax-check / flake8   FAIL   5.24s   exit status 2

[1]: https://pycqa.github.io/isort/

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2023-06-29 11:51:27 +02:00

13 lines
321 B
Python
Executable File

#!/usr/bin/env python3
import os
from datetime import datetime, timezone
timestamp = os.environ.get('SOURCE_DATE_EPOCH', None)
timeformat = '%c %Z'
if timestamp:
print(datetime.fromtimestamp(int(timestamp), tz=timezone.utc).strftime(timeformat))
else:
print(datetime.now(tz=timezone.utc).strftime(timeformat))