aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lldb/docs/conf.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lldb/docs/conf.py b/lldb/docs/conf.py
index cf3af56..c9e21fa 100644
--- a/lldb/docs/conf.py
+++ b/lldb/docs/conf.py
@@ -12,7 +12,7 @@
# serve to show the default.
from __future__ import print_function
-import sys, os, re
+import sys, os, re, shutil
from datetime import date
building_man_page = tags.has('builder-man')
@@ -293,8 +293,8 @@ texinfo_documents = [
empty_attr_summary = re.compile(r'\.\. rubric:: Attributes Summary\s*\.\. autosummary::\s*\.\. rubric::')
empty_attr_documentation = re.compile(r'\.\. rubric:: Attributes Documentation\s*\.\. rubric::')
-def cleanup_source(app, docname, source):
- """ Cleans up source files generated by automodapi. """
+def preprocess_source(app, docname, source):
+ """ Preprocesses source files generated by automodapi. """
# Don't cleanup anything beside automodapi-generated sources.
if not automodapi_toctreedirnm in docname:
return
@@ -320,5 +320,12 @@ def cleanup_source(app, docname, source):
# element list).
source[0] = processed
+def cleanup_source(app, exception):
+ """ Remove files generated by automodapi in the source tree. """
+ if hasattr(app.config, 'automodapi_toctreedirnm'):
+ api_source_dir = os.path.join(app.srcdir, app.config.automodapi_toctreedirnm)
+ shutil.rmtree(api_source_dir, ignore_errors=True)
+
def setup(app):
- app.connect('source-read', cleanup_source)
+ app.connect('source-read', preprocess_source)
+ app.connect('build-finished', cleanup_source)