Skip to content

Commit

Permalink
added --keep-original-xml
Browse files Browse the repository at this point in the history
  • Loading branch information
marzer committed Sep 15, 2024
1 parent b952317 commit 5780dd4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion src/poxy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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()

# --------------------------------------------------------------
Expand Down Expand Up @@ -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,
)
Expand Down
3 changes: 3 additions & 0 deletions src/poxy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 9 additions & 2 deletions src/poxy/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5780dd4

Please sign in to comment.