ia64/xen-unstable

changeset 6788:e939d5c5e646

Pass the root directory to Doxyfilter and thence pythfilter.py so that the latter can get the namespace/packages correct.
author ewan@linford.intra
date Tue Sep 13 14:42:21 2005 +0100 (2005-09-13)
parents bcbd2d2c1068
children 723f81936cf7
files docs/Doxyfile docs/pythfilter.py
line diff
     1.1 --- a/docs/Doxyfile	Tue Sep 13 14:41:05 2005 +0100
     1.2 +++ b/docs/Doxyfile	Tue Sep 13 14:42:21 2005 +0100
     1.3 @@ -519,7 +519,7 @@ IMAGE_PATH             =
     1.4  # to standard output.  If FILTER_PATTERNS is specified, this tag will be 
     1.5  # ignored.
     1.6  
     1.7 -INPUT_FILTER           = "sh ./Doxyfilter"
     1.8 +INPUT_FILTER           = "sh ./Doxyfilter ../tools/python"
     1.9  
    1.10  # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
    1.11  # basis.  Doxygen will compare the file name with each pattern and apply the 
     2.1 --- a/docs/pythfilter.py	Tue Sep 13 14:41:05 2005 +0100
     2.2 +++ b/docs/pythfilter.py	Tue Sep 13 14:42:21 2005 +0100
     2.3 @@ -469,12 +469,25 @@ def dump(filename):
     2.4          sys.stdout.write(s)
     2.5  
     2.6  def filter(filename):
     2.7 -    global name, module_has_docstring
     2.8 +    global name, module_has_docstring, source_root
     2.9  
    2.10      path,name = os.path.split(filename)
    2.11      root,ext  = os.path.splitext(name)
    2.12  
    2.13 -    output("namespace "+root+" {\n",(0,0))
    2.14 +    if source_root and path.find(source_root) == 0:
    2.15 +        path = path[len(source_root):]
    2.16 +
    2.17 +        if path[0] == os.sep:
    2.18 +            path = path[1:]
    2.19 +
    2.20 +        ns = path.split(os.sep)
    2.21 +    else:
    2.22 +        ns = []
    2.23 +
    2.24 +    ns.append(root)
    2.25 +
    2.26 +    for n in ns:
    2.27 +        output("namespace " + n + " {\n",(0,0))
    2.28  
    2.29      # set module name for tok_eater to use if there's a module doc string
    2.30      name = root
    2.31 @@ -486,7 +499,9 @@ def filter(filename):
    2.32      print_comment((0,0))
    2.33  
    2.34      output("\n",(0,0))
    2.35 -    output("}  // end of namespace\n",(0,0))
    2.36 +    
    2.37 +    for n in ns:
    2.38 +        output("}  // end of namespace\n",(0,0))
    2.39  
    2.40      if not module_has_docstring:
    2.41          # Put in default namespace documentation
    2.42 @@ -611,9 +626,10 @@ def convert(srcpath, destpath):
    2.43  ######################################################################
    2.44  
    2.45  filter_file = False
    2.46 +source_root = None
    2.47  
    2.48  try:
    2.49 -    opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"])
    2.50 +    opts, args = getopt.getopt(sys.argv[1:], "hfr:", ["help"])
    2.51  except getopt.GetoptError,e:
    2.52      print e
    2.53      sys.exit(1)
    2.54 @@ -622,10 +638,13 @@ for o,a in opts:
    2.55      if o=="-f":
    2.56          filter_file = True
    2.57  
    2.58 +    if o=="-r":
    2.59 +        source_root = os.path.abspath(a)
    2.60 +
    2.61  if filter_file:
    2.62      # Filter the specified file and print the result to stdout
    2.63      filename = string.join(args)
    2.64 -    filterFile(filename)
    2.65 +    filterFile(os.path.abspath(filename))
    2.66  else:
    2.67  
    2.68      if len(args)!=2: