[PATCH 04/32] docs: meson: Add dependencies for RST docs

Peter Krempa pkrempa at redhat.com
Thu Jul 23 13:21:09 UTC 2020


Prepare for splitting out parts of RST documents into separate files by
introducing 'includes' property in the build system. While the include
itself is handled by docutils, it allows us to declare dependencies
between the files so that they are rebuilt properly.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 docs/meson.build | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/docs/meson.build b/docs/meson.build
index 001b1fe6f0..1e1383daa9 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -112,6 +112,7 @@ docs_html_in_files = [
 # docs_rst_files:
 #   each entry is a dictionary with following items:
 #   name - base file name (required)
+#   includes - rst files included by this file (optional)
 docs_rst_files = [
   { 'name': 'advanced-tests' },
   { 'name': 'best-practices' },
@@ -212,9 +213,29 @@ endforeach

 foreach data : docs_rst_files
   rst_file = '@0 at .rst'.format(data['name'])
+  html_in_file = '@0 at .html.in'.format(data['name'])
+  depend_files = []
+
+  if data.has_key('includes')
+    depend_files = files(data['includes'])
+  endif
+
+  out_file = custom_target(
+    html_in_file,
+    input: rst_file,
+    output: html_in_file,
+    command: [
+      rst2html_prog,
+      '--strict',
+      '@INPUT@',
+      '@OUTPUT@',
+    ],
+    depend_files: depend_files,
+  )
+
   docs_html_in_gen += {
     'name': data['name'],
-    'file': docs_rst2html_gen.process(rst_file),
+    'file': out_file,
   }
 endforeach

-- 
2.26.2




More information about the libvir-list mailing list