diff --git a/CHANGELOG.md b/CHANGELOG.md index 716d2a0..5643bb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - added workaround for [this issue](https://github.com/mosra/m.css/issues/239) introduced in Doxygen 1.9.7 +- made `--bug-report` keep a copy of the original (pre-pre-processed?) XML - updated m.css ## v0.18.0 - 2024-08-03 diff --git a/src/poxy/main.py b/src/poxy/main.py index cdd70ea..d97a81b 100644 --- a/src/poxy/main.py +++ b/src/poxy/main.py @@ -329,7 +329,11 @@ def cleanup(): def bug_report(args: argparse.Namespace): - bug_report_args = [arg for arg in sys.argv[1:] if arg not in (r'--bug-report', r'--worker', r'-v', r'--verbose')] + bug_report_args = [ + arg + for arg in sys.argv[1:] + if arg not in (r'--bug-report', r'--worker', r'-v', r'--verbose', r'--keep-original-xml') + ] for key in (r'--output-dir', r'--temp-dir', r'--copy-config-to'): pos = -1 try: @@ -357,6 +361,7 @@ def bug_report(args: argparse.Namespace): r'--worker', r'--verbose', r'--nocleanup', + r'--keep-original-xml', r'--output-dir', str(paths.BUG_REPORT_DIR), r'--temp-dir', @@ -520,6 +525,7 @@ def main(invoker=True): args.add_argument(r'--temp-dir', type=Path, default=None, help=argparse.SUPPRESS) # args.add_argument(r'--copy-config-to', type=Path, default=None, help=argparse.SUPPRESS) # args.add_argument(r'--versions-in-navbar', action=r'store_true', help=argparse.SUPPRESS) # + args.add_argument(r'--keep-original-xml', action=r'store_true', help=argparse.SUPPRESS) # args = args.parse_args() # -------------------------------------------------------------- @@ -632,6 +638,7 @@ def main(invoker=True): temp_dir=args.temp_dir, copy_config_to=args.copy_config_to, versions_in_navbar=args.versions_in_navbar, + keep_original_xml=args.keep_original_xml, # kwargs: xml_v2=args.xml_v2, ) diff --git a/src/poxy/project.py b/src/poxy/project.py index 00848fb..669fbc2 100644 --- a/src/poxy/project.py +++ b/src/poxy/project.py @@ -1286,8 +1286,11 @@ def __init__( # temp xml output path used by doxygen self.temp_xml_dir = Path(self.temp_dir, r'xml') + self.temp_original_xml_dir = Path(self.temp_dir, r'xml_original') self.verbose_value(r'Context.temp_xml_dir', self.temp_xml_dir) + self.verbose_value(r'Context.temp_original_xml_dir', self.temp_original_xml_dir) assert self.temp_xml_dir.is_absolute() + assert self.temp_original_xml_dir.is_absolute() # xml output path (--xml) self.xml_dir = Path(self.output_dir, r'xml') diff --git a/src/poxy/run.py b/src/poxy/run.py index 432b2b4..b5031cb 100644 --- a/src/poxy/run.py +++ b/src/poxy/run.py @@ -1172,11 +1172,13 @@ def extract_types_from_tagfile_node(node): context.verbose_object(r'Context.code_blocks', context.code_blocks) -def clean_xml(context: Context): +def clean_xml(context: Context, dir=None): assert context is not None assert isinstance(context, Context) + if dir is None: + dir = context.temp_xml_dir - xml_files = get_all_files(context.temp_xml_dir, any=(r'*.xml')) + xml_files = get_all_files(dir, any=(r'*.xml')) for xml_file in xml_files: root = xml_utils.read( xml_file, parser=xml_utils.create_parser(remove_blank_text=True), logger=context.verbose_logger # @@ -1738,6 +1740,7 @@ def run( temp_dir: Path = None, copy_config_to: Path = None, versions_in_navbar: bool = False, + keep_original_xml: bool = False, **kwargs, ): timer = lambda desc: ScopeTimer(desc, print_start=True, print_end=context.verbose_logger) @@ -1771,7 +1774,11 @@ def run( # generate + postprocess XML in temp_xml_dir # (we always do this even when output_xml is false because it is required by the html) with timer(rf'Generating XML files with Doxygen {doxygen.version_string()}') as t: + delete_directory(context.temp_original_xml_dir) run_doxygen(context) + if keep_original_xml: + copy_tree(str(context.temp_xml_dir), str(context.temp_original_xml_dir)) + clean_xml(context, dir=context.temp_original_xml_dir) with timer(r'Post-processing XML files') as t: if context.xml_v2: postprocess_xml_v2(context)