aboutsummaryrefslogtreecommitdiffstats
path: root/lv2specgen
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-04-16 02:10:04 +0200
committerDavid Robillard <d@drobilla.net>2018-04-21 13:55:58 +0200
commit06700865e1324fc33ae864a5114900cfc7dce6f5 (patch)
tree8b51682546f26449d7d9ade34f5abb18c6bbf575 /lv2specgen
parent728196c9d55100b63b74b2f118bd80d451636a6c (diff)
downloadlv2-06700865e1324fc33ae864a5114900cfc7dce6f5.tar.xz
Allow build date to be overridden for reproducible documentation
See https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable.
Diffstat (limited to 'lv2specgen')
-rwxr-xr-xlv2specgen/lv2specgen.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 11647f2..38594fb 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -46,6 +46,7 @@ import optparse
import os
import re
import sys
+import time
import xml.sax.saxutils
import xml.dom
import xml.dom.minidom
@@ -1374,8 +1375,10 @@ def specgen(specloc, indir, style_uri, docdir, tags, opts, instances=False, root
else:
template = template.replace('@COMMENT@', '')
- template = template.replace('@DATE@', datetime.datetime.utcnow().strftime('%F'))
- template = template.replace('@TIME@', datetime.datetime.utcnow().strftime('%F %H:%M UTC'))
+ now = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
+ build_date = datetime.datetime.utcfromtimestamp(now)
+ template = template.replace('@DATE@', build_date.strftime('%F'))
+ template = template.replace('@TIME@', build_date.strftime('%F %H:%M UTC'))
# Write index row
if index_path is not None: