summary refs log tree commit diff stats
path: root/docs/sphinx
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-08 14:56:10 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-08 14:56:10 +0100
commit260f9210d2ce892c5e162a45b0e5ec0036bedc79 (patch)
treed6262096025eab3b09fbd16e6c3588ed70fc5e83 /docs/sphinx
parent63ed851de474b1e2458cb9b4ba6e02a88f72c25c (diff)
parentc11b3a1dd324d1f7dc8512bb840ffd8226fbd0a7 (diff)
downloadfocaccia-qemu-260f9210d2ce892c5e162a45b0e5ec0036bedc79.tar.gz
focaccia-qemu-260f9210d2ce892c5e162a45b0e5ec0036bedc79.zip
Merge remote-tracking branch 'remotes/marcandre.lureau/tags/sphinx-pull-request' into staging
Some Sphinx improvements

PR for 2 series:
https://patchew.org/QEMU/20211015105344.152591-1-marcandre.lureau@redhat.com/
https://patchew.org/QEMU/20211004215238.1523082-1-jsnow@redhat.com/

# gpg: Signature made Mon 08 Nov 2021 10:01:03 AM CET
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]

* remotes/marcandre.lureau/tags/sphinx-pull-request:
  docs/sphinx: change default role to "any"
  docs: (further) remove non-reference uses of single backticks
  docs: remove non-reference uses of single backticks
  docs/sphinx: add 's' keyboard binding to focus search
  docs/sphinx: set navigation_with_keys=True
  meson: drop sphinx_template_files
  meson: drop sphinx_extn_depends
  tests/qapi-schema/meson: add depfile to sphinx doc
  docs/sphinx: add templates files to generated depfile
  docs/sphinx: add static files to generated depfile
  docs/sphinx: add loaded modules to generated depfile

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'docs/sphinx')
-rw-r--r--docs/sphinx/depfile.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/docs/sphinx/depfile.py b/docs/sphinx/depfile.py
index 277fdf0f56..afdcbcec6e 100644
--- a/docs/sphinx/depfile.py
+++ b/docs/sphinx/depfile.py
@@ -12,6 +12,8 @@
 
 import os
 import sphinx
+import sys
+from pathlib import Path
 
 __version__ = '1.0'
 
@@ -20,8 +22,21 @@ def get_infiles(env):
         yield env.doc2path(x)
         yield from ((os.path.join(env.srcdir, dep)
                     for dep in env.dependencies[x]))
+    for mod in sys.modules.values():
+        if hasattr(mod, '__file__'):
+            if mod.__file__:
+                yield mod.__file__
+    # this is perhaps going to include unused files:
+    for static_path in env.config.html_static_path + env.config.templates_path:
+        for path in Path(static_path).rglob('*'):
+            yield str(path)
 
-def write_depfile(app, env):
+
+def write_depfile(app, exception):
+    if exception:
+        return
+
+    env = app.env
     if not env.config.depfile:
         return
 
@@ -42,7 +57,7 @@ def write_depfile(app, env):
 def setup(app):
     app.add_config_value('depfile', None, 'env')
     app.add_config_value('depfile_stamp', None, 'env')
-    app.connect('env-updated', write_depfile)
+    app.connect('build-finished', write_depfile)
 
     return dict(
         version = __version__,