]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: docs: generate docs timestamp
authorPavel Hrdina <phrdina@redhat.com>
Mon, 29 Jun 2020 20:14:13 +0000 (22:14 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:06 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
docs/Makefile.am
docs/meson.build
scripts/meson-timestamp.py [new file with mode: 0755]
scripts/meson.build

index 1237b4c47cc42edba8747756168550feed697bcb..f54336cf35dc56e1358016505df7ef1671caa969 100644 (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) \
index 9bd4e19b3f086ca201f1fda18955a27369d8f1f1..7fbd46af7c717be01f581dd10eeb8aca33caa491 100644 (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: [
diff --git a/scripts/meson-timestamp.py b/scripts/meson-timestamp.py
new file mode 100755 (executable)
index 0000000..f109cad
--- /dev/null
@@ -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))
index e1ecda2a0c79d923b68dcf5ce65ef845bcd6dd45..d1d069847d8ebbd8779c2d64753f7480e8e3efea 100644 (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',