meson: docs: generate docs timestamp

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-29 22:14:13 +02:00
parent 4dc0e601c7
commit c98eac9c59
4 changed files with 18 additions and 7 deletions

View File

@ -306,13 +306,6 @@ aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
$(top_srcdir)/scripts/genaclperms.py Makefile.am
$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/genaclperms.py $< > $@
timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \
then \
date -u --date="@$$SOURCE_DATE_EPOCH"; \
else \
date -u; \
fi)"
hvsupport.html: hvsupport.html.in
hvsupport.html.in: $(top_srcdir)/scripts/hvsupport.py $(api_DATA) \

View File

@ -29,6 +29,10 @@ docs_assets = [
install_data(docs_assets, install_dir: docs_html_dir)
docs_timestamp = run_command(
python3_prog, meson_timestamp_prog.path(), env: runutf8
).stdout().strip()
docs_api_generated = custom_target(
'generate-api',
output: [

13
scripts/meson-timestamp.py Executable file
View File

@ -0,0 +1,13 @@
#!/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))

View File

@ -23,6 +23,7 @@ scripts = [
'meson-install-dirs.py',
'meson-install-symlink.py',
'meson-python.sh',
'meson-timestamp.py',
'mock-noinline.py',
'prohibit-duplicate-header.py',
'test-wrap-argv.py',