summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/makeversionhdr.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py
index 970a86e6c..2f4bc9182 100644
--- a/py/makeversionhdr.py
+++ b/py/makeversionhdr.py
@@ -80,6 +80,12 @@ def make_version_header(filename):
git_tag, git_hash = info
+ build_date = datetime.date.today()
+ if "SOURCE_DATE_EPOCH" in os.environ:
+ build_date = datetime.datetime.utcfromtimestamp(
+ int(os.environ["SOURCE_DATE_EPOCH"])
+ ).date()
+
# Generate the file with the git and version info
file_data = """\
// This file was generated by py/makeversionhdr.py
@@ -89,7 +95,7 @@ def make_version_header(filename):
""" % (
git_tag,
git_hash,
- datetime.date.today().strftime("%Y-%m-%d"),
+ build_date.strftime("%Y-%m-%d"),
)
# Check if the file contents changed from last time