From f194ef281be2d56dcdd4f07b43232690d2047b4a Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Mon, 14 Aug 2017 17:19:03 +0100 Subject: [PATCH] Documentation/Builds: Delete previously generated docs As the Makefile is no longer responsible for calling the extension and instrumentation documentation ensure any previously generated documentation is deleted from the respective build file. --- doc/build_extension_docs.py | 4 ++++ doc/build_instrumentation_method_map.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/doc/build_extension_docs.py b/doc/build_extension_docs.py index bee61cdd..f0569d0a 100755 --- a/doc/build_extension_docs.py +++ b/doc/build_extension_docs.py @@ -17,6 +17,7 @@ import os import sys +import shutil from wlauto import ExtensionLoader from wlauto.utils.doc import get_rst_from_extension, underline @@ -30,6 +31,9 @@ def generate_extension_documentation(source_dir, outdir, ignore_paths): loader = ExtensionLoader(keep_going=True) loader.clear() loader.update(paths=[source_dir], ignore_paths=ignore_paths) + if os.path.exists(outdir): + shutil.rmtree(outdir) + os.makedirs(outdir) for ext_type in loader.extension_kinds: if not ext_type in GENERATE_FOR: continue diff --git a/doc/build_instrumentation_method_map.py b/doc/build_instrumentation_method_map.py index a9438c92..7dc61c92 100755 --- a/doc/build_instrumentation_method_map.py +++ b/doc/build_instrumentation_method_map.py @@ -38,6 +38,8 @@ def generate_instrumentation_method_map(outfile): headers=['method name', 'signal'], align='<<') priority_table = format_simple_table([(escape_trailing_underscore(k), v) for k, v in PRIORITY_MAP.iteritems()], headers=['prefix', 'priority'], align='<>') + if os.path.isfile(outfile): + os.unlink(outfile) with open(OUTPUT_TEMPLATE_FILE) as fh: template = string.Template(fh.read()) with open(outfile, 'w') as wfh: