51 Parse a Doxygen source file and return a dictionary of all the values.
52 Values will be strings and lists of strings.
59 lex = shlex.shlex(instream=file_contents, posix=
True)
60 lex.wordchars +=
"*+./-:@"
61 lex.whitespace = lex.whitespace.replace(
"\n",
"")
65 token = lex.get_token()
72 def append_data(data, key, new_data, token):
73 if new_data
or len(data[key]) == 0:
74 data[key].append(token)
76 data[key][-1] += token
80 if last_token
not in [
"\\"]:
92 if key ==
"TAGFILES" and key
in data:
93 append_data(data, key,
False,
"=")
95 elif key ==
"@INCLUDE" and key
in data:
100 elif key ==
"@INCLUDE":
104 if not os.path.isabs(nextfile):
105 nextfile = os.path.join(conf_dir, nextfile)
106 if nextfile
in data[key]:
107 raise Exception(
"recursive @INCLUDE in Doxygen config: " + nextfile)
108 data[key].append(nextfile)
109 with open(nextfile,
"r")
as fh:
112 append_data(data, key, new_data, token)
116 token = lex.get_token()
118 if last_token ==
"\\" and token !=
"\n":
120 append_data(data, key, new_data,
"\\")
123 for (k, v)
in list(data.items()):
128 if k
in [
"INPUT",
"FILE_PATTERNS",
"EXCLUDE_PATTERNS",
"TAGFILES",
"@INCLUDE"]:
139 Scan the given node's contents (a Doxygen file) and add
140 any files used to generate docs to the list of source files.
142 default_file_patterns = [
170 default_exclude_patterns = [
180 conf_dir = os.path.dirname(str(node))
184 if data.get(
"RECURSIVE",
"NO") ==
"YES":
189 file_patterns = data.get(
"FILE_PATTERNS", default_file_patterns)
190 exclude_patterns = data.get(
"EXCLUDE_PATTERNS", default_exclude_patterns)
192 input = data.get(
"INPUT")
194 for node
in data.get(
"INPUT", []):
195 if not os.path.isabs(node):
196 node = os.path.join(conf_dir, node)
197 if os.path.isfile(node):
199 elif os.path.isdir(node):
201 for root, dirs, files
in os.walk(node):
203 filename = os.path.join(root, f)
205 pattern_check = reduce(
206 lambda x, y: x
or bool(fnmatch(filename, y)),
210 exclude_check = reduce(
211 lambda x, y: x
and fnmatch(filename, y),
216 if pattern_check
and not exclude_check:
217 sources.append(filename)
219 for pattern
in file_patterns:
220 sources.extend(glob.glob(
"/".join([node, pattern])))
224 for root, dirs, files
in os.walk(
"."):
226 filename = os.path.join(root, f)
228 pattern_check = reduce(
229 lambda x, y: x
or bool(fnmatch(filename, y)),
233 exclude_check = reduce(
234 lambda x, y: x
and fnmatch(filename, y), exclude_patterns,
True
237 if pattern_check
and not exclude_check:
238 sources.append(filename)
240 for pattern
in file_patterns:
241 sources.extend(glob.glob(pattern))
244 for node
in data.get(
"@INCLUDE", []):
248 for node
in data.get(
"TAGFILES", []):
249 file = node.split(
"=")[0]
250 if not os.path.isabs(file):
251 file = os.path.join(conf_dir, file)
255 def append_additional_source(option, formats):
257 if data.get(
"GENERATE_" + f, output_formats[f][0]) ==
"YES":
258 file = data.get(option,
"")
260 if not os.path.isabs(file):
261 file = os.path.join(conf_dir, file)
262 if os.path.isfile(file):
266 append_additional_source(
"HTML_STYLESHEET", [
"HTML"])
267 append_additional_source(
"HTML_HEADER", [
"HTML"])
268 append_additional_source(
"HTML_FOOTER", [
"HTML"])
373 Add builders and construction variables for the
374 Doxygen tool. This is currently for Doxygen 1.4.6.
376 doxyfile_scanner = env.Scanner(
379 scan_check=DoxySourceScanCheck,
384 doxyfile_builder = SCons.Builder.Builder(
385 action = "cd ${SOURCE.dir} && (${DOXYGEN} ${SOURCE.file} 2>&1 |tee ,doxylog)",
386 emitter = DoxyEmitter,
387 target_factory = env.fs.Entry,
388 single_source = True,
389 source_scanner = doxyfile_scanner,
394 "Doxygen": doxyfile_builder,