Commits

Anonymous committed 4725eb1

Merge in all the changes from Beohme's version.

Comments (0)

Files changed (1)

          key_token = False
       else:
          if token == "+=":
-            if key not in data:
-               data[key] = []
+            if not data.has_key(key):
+               data[key] = list()
          elif token == "=":
-            data[key] = []
+            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
          append_data( data, key, new_data, '\\' )
 
    # compress lists of len 1 into single strings
-   for k, v in data.items():
+   for (k, v) in data.items():
       if len(v) == 0:
          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:
 
    data = DoxyfileParse(node.get_contents())
 
-   recursive = data.get("RECURSIVE") == "YES"
+   if data.get("RECURSIVE", "NO") == "YES":
+      recursive = True
+   else:
+      recursive = False
 
    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):
                for f in files:
                   filename = os.path.join(root, f)
 
-                  pattern_check = any(fnmatch(filename, y) for y in file_patterns)
-                  exclude_check = any(fnmatch(filename, y) for y in exclude_patterns)
+                  pattern_check = reduce(lambda x, y: x or bool(fnmatch(filename, y)), file_patterns, False)
+                  exclude_check = reduce(lambda x, y: x and fnmatch(filename, y), exclude_patterns, True)
 
                   if pattern_check and not exclude_check:
                      sources.append(filename)
             for pattern in file_patterns:
                sources.extend(glob.glob("/".join([node, pattern])))
 
-   sources = [env.File(path) for path in sources]
+   # 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
 
 
       "HTML": ("YES", "html"),
       "LATEX": ("YES", "latex"),
       "RTF": ("NO", "rtf"),
-      "MAN": ("NO", "man"),
+      "MAN": ("YES", "man"),
       "XML": ("NO", "xml"),
    }
 
 
    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():
+   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)