diff --git a/__init__.py b/__init__.py index fd51393e7..c60d940e1 100644 --- a/__init__.py +++ b/__init__.py @@ -63,7 +63,11 @@ def DoxyfileParse(file_contents): if not data.has_key(key): data[key] = list() elif token == "=": - data[key] = list() + if key == "TAGFILES" and data.has_key(key): + append_data( data, key, False, "=" ) + new_data=False + else: + data[key] = list() else: append_data( data, key, new_data, token ) new_data = True @@ -81,7 +85,7 @@ def DoxyfileParse(file_contents): data.pop(k) # items in the following list will be kept as lists and not converted to strings - if k in ["INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS"]: + if k in ["INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "TAGFILES"]: continue if len(v) == 1: @@ -117,7 +121,15 @@ def DoxySourceScan(node, env, path): file_patterns = data.get("FILE_PATTERNS", default_file_patterns) exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns) + # We're running in the top-level directory, but the doxygen + # configuration file is in the same directory as node; this means + # that relative pathnames in node must be adjusted before they can + # go onto the sources list + conf_dir = os.path.dirname(str(node)) + for node in data.get("INPUT", []): + if not os.path.isabs(node): + node = os.path.join(conf_dir, node) if os.path.isfile(node): sources.append(node) elif os.path.isdir(node): @@ -135,6 +147,26 @@ def DoxySourceScan(node, env, path): for pattern in file_patterns: sources.extend(glob.glob("/".join([node, pattern]))) + # Add tagfiles to the list of source files: + for node in data.get("TAGFILES", []): + file = node.split("=")[0] + if not os.path.isabs(file): + file = os.path.join(conf_dir, file) + sources.append(file) + + # Add additional files to the list of source files: + def append_additional_source(option): + file = data.get(option, "") + if file != "": + if not os.path.isabs(file): + file = os.path.join(conf_dir, file) + if os.path.isfile(file): + sources.append(file) + + append_additional_source("HTML_STYLESHEET") + append_additional_source("HTML_HEADER") + append_additional_source("HTML_FOOTER") + sources = map( lambda path: env.File(path), sources ) return sources @@ -158,12 +190,23 @@ def DoxyEmitter(source, target, env): targets = [] out_dir = data.get("OUTPUT_DIRECTORY", ".") + if not os.path.isabs(out_dir): + conf_dir = os.path.dirname(str(source[0])) + out_dir = os.path.join(conf_dir, out_dir) # add our output locations for (k, v) in output_formats.items(): if data.get("GENERATE_" + k, v[0]) == "YES": targets.append(env.Dir( os.path.join(out_dir, data.get(k + "_OUTPUT", v[1]))) ) + # add the tag file if neccessary: + tagfile = data.get("GENERATE_TAGFILE", "") + if tagfile != "": + if not os.path.isabs(tagfile): + conf_dir = os.path.dirname(str(source[0])) + tagfile = os.path.join(conf_dir, tagfile) + targets.append(env.File(tagfile)) + # don't clobber targets for node in targets: env.Precious(node) @@ -185,13 +228,12 @@ def generate(env): scan_check = DoxySourceScanCheck, ) - doxyfile_builder = env.Builder( - action = env.Action("cd ${SOURCE.dir} && ${DOXYGEN} ${SOURCE.file}"), + import SCons.Builder + doxyfile_builder = SCons.Builder.Builder( + action = "cd ${SOURCE.dir} && ${DOXYGEN} ${SOURCE.file}", emitter = DoxyEmitter, target_factory = env.fs.Entry, single_source = True, - - source_scanner = doxyfile_scanner, )