X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FDoxygen.py;h=2b4530b0ac3cac6b1a819330523944441a9d75d0;hb=87204d50de0c429f265aec817bc9efd9af816082;hp=0e8dd2435f3c7750c2fc630015f243191f71c0af;hpb=9035ae419b1dc9dc537e00d0f7ffc4b22e19422a;p=senf.git diff --git a/senfscons/Doxygen.py b/senfscons/Doxygen.py index 0e8dd24..2b4530b 100644 --- a/senfscons/Doxygen.py +++ b/senfscons/Doxygen.py @@ -18,8 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # The Modifications are Copyright (C) 2006,2007 -# Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -# Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +# Fraunhofer Institute for Open Communication Systems (FOKUS) +# Competence Center NETwork research (NET), St. Augustin, GERMANY # Stefan Bund ## \file @@ -234,7 +234,7 @@ class DoxyfileParser: for d in [ self._dir ] + self._include_path: p = os.path.join(d,value[0]) if os.path.exists(p): - self._items.setdefault('@INCLDUE',[]).append(p) + self._items.setdefault('@INCLUDE',[]).append(p) parser = DoxyfileParser(p, self._env, self._include_path, self._items) parser.parse() return @@ -248,9 +248,13 @@ class DoxyfileParser: return self._items def DoxyfileParse(env,file): + # We don't parse source files which do not contain the word 'doxyfile'. SCons will + # pass other dependencies to DoxyfileParse which are not doxyfiles ... grmpf ... + if not 'doxyfile' in file.lower(): + return {} ENV = {} ENV.update(env.get("ENV",{})) - ENV['TOPDIR'] = env.Dir('#').abspath + ENV.update(env.get("DOXYENV", {})) parser = DoxyfileParser(file,ENV) try: parser.parse() @@ -260,7 +264,7 @@ def DoxyfileParse(env,file): data = parser.items() for k,v in data.items(): if not v : del data[k] - elif k in ("INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "@INCLUDE", "TAGFILES") : continue + elif k in ("LAYOUT_FILE", "INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "@INCLUDE", "TAGFILES") : continue elif len(v)==1 : data[k] = v[0] return data @@ -270,9 +274,22 @@ def DoxySourceScan(node, env, path): any files used to generate docs to the list of source files. """ dep_add_keys = ( - '@INCLUDE', 'HTML_HEADER', 'HTML_FOOTER', 'TAGFILES', 'INPUT_FILTER' + ('HTML', 'LAYOUT_FILE'), + (None, '@INCLUDE'), + ('HTML', 'HTML_HEADER'), + ('HTML', 'HTML_FOOTER'), + (None, 'TAGFILES'), + (None, 'INPUT_FILTER'), ) + output_formats = { + "HTML" : ("YES", "html"), + "LATEX" : ("YES", "latex"), + "RTF" : ("NO", "rtf"), + "MAN" : ("YES", "man"), + "XML" : ("NO", "xml"), + } + default_file_patterns = ( '*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx', '*.ipp', '*.i++', '*.inl', '*.h', '*.hh ', '*.hxx', '*.hpp', '*.h++', @@ -301,18 +318,16 @@ def DoxySourceScan(node, env, path): for root, dirs, files in entries: for f in files: filename = os.path.normpath(os.path.join(root, f)) - if ( reduce(lambda x, y: x or fnmatch(f, y), - file_patterns, False) - and not reduce(lambda x, y: x or fnmatch(f, y), - exclude_patterns, False) ): + if ( reduce(lambda x, y: x or fnmatch(f, y), file_patterns, False) + and not reduce(lambda x, y: x or fnmatch(f, y), exclude_patterns, False) ): sources.append(filename) - for key in dep_add_keys: - if data.has_key(key): - elt = data[key] - if type(elt) is type ("") : elt = [ elt ] + for fmt, key in dep_add_keys: + if data.has_key(key) and \ + (fmt is None or data.get("GENERATE_%s" % fmt, output_formats[fmt][0]).upper() == "YES"): + elt = env.Flatten(env.subst_list(data[key])) sources.extend([ os.path.normpath(os.path.join(basedir,f)) - for f in elt ]) + for f in elt if f ]) sources = map( lambda path: env.File(path), sources ) return sources @@ -335,18 +350,20 @@ def DoxyEmitter(source, target, env): data = DoxyfileParse(env, source[0].abspath) targets = [] - if data.has_key("OUTPUT_DIRECTORY"): + if data.get("OUTPUT_DIRECTORY",""): out_dir = data["OUTPUT_DIRECTORY"] dir = env.Dir( os.path.join(source[0].dir.abspath, out_dir) ) dir.sources = source - if env.GetOption('clean'): targets.append(dir) + if env.GetOption('clean'): + targets.append(dir) + return (targets, source) else: out_dir = '.' # add our output locations html_dir = None for (k, v) in output_formats.iteritems(): - if data.get("GENERATE_" + k, v[0]).upper() == "YES": + if data.get("GENERATE_" + k, v[0]).upper() == "YES" and data.get(k + "_OUTPUT", v[1]): dir = env.Dir( os.path.join(source[0].dir.abspath, out_dir, data.get(k + "_OUTPUT", v[1])) ) if k == "HTML" : html_dir = dir dir.sources = source @@ -354,10 +371,10 @@ def DoxyEmitter(source, target, env): targets.append(node) if env.GetOption('clean'): targets.append(dir) - if data.has_key("GENERATE_TAGFILE") and html_dir: + if data.get("GENERATE_TAGFILE",""): targets.append(env.File( os.path.join(source[0].dir.abspath, data["GENERATE_TAGFILE"]) )) - if data.get("SEARCHENGINE","NO").upper() == "YES": + if data.get("SEARCHENGINE","NO").upper() == "YES" and html_dir: targets.append(env.File( os.path.join(html_dir.abspath, "search.idx") )) # don't clobber targets @@ -387,53 +404,12 @@ def relpath(source, target): target_elts[prefix_len:])) def DoxyGenerator(source, target, env, for_signature): - data = DoxyfileParse(env, source[0].abspath) - - actions = [ SCons.Action.Action("cd ${SOURCE.dir} && TOPDIR=%s ${DOXYGEN} ${SOURCE.file}" - % (relpath(source[0].dir.abspath, env.Dir('#').abspath),)) ] - - # This will add automatic 'installdox' calls. - # - # For every referenced tagfile, the generator first checks for the - # existence of a construction variable '_DOXY_URL' where - # '' is the uppercased name of the tagfile sans extension - # (e.g. 'Utils.tag' -> 'UTILS_DOXY_URL'). If this variable exists, - # it must contain the url or path to the installed documentation - # corresponding to the tag file. - # - # Is the variable is not found and if a referenced tag file is a - # target within this same build, the generator will parse the - # 'Doxyfile' from which the tag file is built. It will - # automatically create the html directory from the information in - # that 'Doxyfile'. - # - # If for any referenced tagfile no url can be found, 'installdox' - # will *not* be called and a warning about the missing url is - # generated. - - if data.get('GENERATE_HTML','YES').upper() == "YES": - output_dir = os.path.normpath(os.path.join( source[0].dir.abspath, - data.get("OUTPUT_DIRECTORY","."), - data.get("HTML_OUTPUT","html") )) - args = [] - for tagfile in data.get('TAGFILES',[]): - url = env.get(os.path.splitext(os.path.basename(tagfile))[0].upper()+"_DOXY_URL", None) - if not url: - url = doxyNodeHtmlDir( - env, - env.File(os.path.normpath(os.path.join(str(source[0].dir), tagfile)))) - if url : url = relpath(output_dir, url) - if not url: - print "WARNING:",source[0].abspath, ": missing tagfile url for", tagfile - args = None - if args is not None and url: - args.append("-l %s@%s" % ( os.path.basename(tagfile), url )) - if args: - actions.append(SCons.Action.Action('cd %s && ./installdox %s' % (output_dir, " ".join(args)))) - - actions.append(SCons.Action.Action([ "touch $TARGETS" ])) - + actions = [ + SCons.Action.Action("$DOXYGENCOM"), + SCons.Action.Action([ "touch $TARGETS" ]), + ] + return actions def generate(env): @@ -448,20 +424,19 @@ def generate(env): ) doxyfile_builder = env.Builder( - # scons 0.96.93 hang on the next line but I don't know hot to FIX the problem generator = DoxyGenerator, emitter = DoxyEmitter, target_factory = env.fs.Entry, single_source = True, - source_scanner = doxyfile_scanner + source_scanner = doxyfile_scanner ) env.Append(BUILDERS = { 'Doxygen': doxyfile_builder, }) - env.AppendUnique( - DOXYGEN = 'doxygen', + env.SetDefault( + DOXYGENCOM = 'cd ${SOURCE.dir} && doxygen ${SOURCE.file}' ) def exists(env):