qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/8] docs/sphinx: add loaded modules to generated depfile


From: John Snow
Subject: Re: [PATCH v2 1/8] docs/sphinx: add loaded modules to generated depfile
Date: Tue, 26 Oct 2021 17:04:29 -0400



On Fri, Oct 15, 2021 at 6:57 AM <marcandre.lureau@redhat.com> wrote:
From: Marc-André Lureau <marcandre.lureau@redhat.com>


You also fix *when* the deps are generated. Small commit message blurb would be nice.
 
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: John Snow <jsnow@redhat.com>
 
---
 docs/sphinx/depfile.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/sphinx/depfile.py b/docs/sphinx/depfile.py
index 277fdf0f56..b6fb926df1 100644
--- a/docs/sphinx/depfile.py
+++ b/docs/sphinx/depfile.py
@@ -12,6 +12,7 @@

 import os
 import sphinx
+import sys

 __version__ = '1.0'

@@ -20,8 +21,17 @@ 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__


(How annoying that built-in modules aren't a different class and that this attribute really is just entirely missing sometimes ...)
 
-def write_depfile(app, env):
+
+def write_depfile(app, exception):
+    if exception:
+        return
+
+    env = app.env
     if not env.config.depfile:
         return

@@ -42,7 +52,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__,
--
2.33.0.721.g106298f7f9



reply via email to

[Prev in Thread] Current Thread [Next in Thread]