return parsed
def parse_doxyfile(state: State, doxyfile, config = None):
+ state.basedir = os.path.dirname(doxyfile)
+
logging.debug("Parsing configuration from {}".format(doxyfile))
comment_re = re.compile(r"""^\s*(#.*)?$""")
default_wildcard = '*.xml'
default_templates = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates/doxygen/')
-def run(doxyfile, *, templates=default_templates, wildcard=default_wildcard, index_pages=default_index_pages, search_add_lookahead_barriers=True, search_merge_subtrees=True, search_merge_prefixes=True, sort_globbed_files=False):
- state = State()
- state.basedir = os.path.dirname(doxyfile)
-
- parse_doxyfile(state, doxyfile)
+def run(state: State, *, templates=default_templates, wildcard=default_wildcard, index_pages=default_index_pages, search_add_lookahead_barriers=True, search_merge_subtrees=True, search_merge_prefixes=True, sort_globbed_files=False):
xml_input = os.path.join(state.basedir, state.doxyfile['OUTPUT_DIRECTORY'], state.doxyfile['XML_OUTPUT'])
xml_files_metadata = [os.path.join(xml_input, f) for f in glob.glob(os.path.join(xml_input, "*.xml"))]
xml_files = [os.path.join(xml_input, f) for f in glob.glob(os.path.join(xml_input, wildcard))]
# Make the Doxyfile path absolute, otherwise everything gets messed up
doxyfile = os.path.abspath(args.doxyfile)
+ state = State()
+ parse_doxyfile(state, doxyfile)
+
+ # Doxygen is stupid and can't create nested directories, create the input
+ # directory for it
+ os.makedirs(state.doxyfile['OUTPUT_DIRECTORY'], exist_ok=True)
+
if not args.no_doxygen:
logging.debug("running Doxygen on {}".format(args.doxyfile))
subprocess.run(["doxygen", doxyfile], cwd=os.path.dirname(doxyfile))
- run(doxyfile, templates=os.path.abspath(args.templates), wildcard=args.wildcard, index_pages=args.index_pages, search_merge_subtrees=not args.search_no_subtree_merging, search_add_lookahead_barriers=not args.search_no_lookahead_barriers, search_merge_prefixes=not args.search_no_prefix_merging)
+ run(state, templates=os.path.abspath(args.templates), wildcard=args.wildcard, index_pages=args.index_pages, search_merge_subtrees=not args.search_no_subtree_merging, search_add_lookahead_barriers=not args.search_no_lookahead_barriers, search_merge_prefixes=not args.search_no_prefix_merging)
import subprocess
import unittest
-from doxygen import run, default_templates, default_wildcard, default_index_pages
+from doxygen import State, parse_doxyfile, run, default_templates, default_wildcard, default_index_pages
def doxygen_version():
return subprocess.check_output(['doxygen', '-v']).decode('utf-8').strip()
if os.path.exists(os.path.join(self.path, 'html')): shutil.rmtree(os.path.join(self.path, 'html'))
def run_doxygen(self, templates=default_templates, wildcard=default_wildcard, index_pages=default_index_pages):
- run(os.path.join(self.path, 'Doxyfile'), templates=templates, wildcard=wildcard, index_pages=index_pages, sort_globbed_files=True)
+ state = State()
+ parse_doxyfile(state, os.path.join(self.path, 'Doxyfile'))
+ run(state, templates=templates, wildcard=wildcard, index_pages=index_pages, sort_globbed_files=True)
def actual_expected_contents(self, actual, expected = None):
if not expected: expected = actual