xen-vtx-unstable

diff docs/pythfilter.py @ 6768: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 64d6de1ea743
children 4d899a738d59 e7c7196fa329
line diff
     1.1 --- a/docs/pythfilter.py	Tue Sep 13 14:41:05 2005 +0100
     1.2 +++ b/docs/pythfilter.py	Tue Sep 13 14:42:21 2005 +0100
     1.3 @@ -469,12 +469,25 @@ def dump(filename):
     1.4          sys.stdout.write(s)
     1.5  
     1.6  def filter(filename):
     1.7 -    global name, module_has_docstring
     1.8 +    global name, module_has_docstring, source_root
     1.9  
    1.10      path,name = os.path.split(filename)
    1.11      root,ext  = os.path.splitext(name)
    1.12  
    1.13 -    output("namespace "+root+" {\n",(0,0))
    1.14 +    if source_root and path.find(source_root) == 0:
    1.15 +        path = path[len(source_root):]
    1.16 +
    1.17 +        if path[0] == os.sep:
    1.18 +            path = path[1:]
    1.19 +
    1.20 +        ns = path.split(os.sep)
    1.21 +    else:
    1.22 +        ns = []
    1.23 +
    1.24 +    ns.append(root)
    1.25 +
    1.26 +    for n in ns:
    1.27 +        output("namespace " + n + " {\n",(0,0))
    1.28  
    1.29      # set module name for tok_eater to use if there's a module doc string
    1.30      name = root
    1.31 @@ -486,7 +499,9 @@ def filter(filename):
    1.32      print_comment((0,0))
    1.33  
    1.34      output("\n",(0,0))
    1.35 -    output("}  // end of namespace\n",(0,0))
    1.36 +    
    1.37 +    for n in ns:
    1.38 +        output("}  // end of namespace\n",(0,0))
    1.39  
    1.40      if not module_has_docstring:
    1.41          # Put in default namespace documentation
    1.42 @@ -611,9 +626,10 @@ def convert(srcpath, destpath):
    1.43  ######################################################################
    1.44  
    1.45  filter_file = False
    1.46 +source_root = None
    1.47  
    1.48  try:
    1.49 -    opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"])
    1.50 +    opts, args = getopt.getopt(sys.argv[1:], "hfr:", ["help"])
    1.51  except getopt.GetoptError,e:
    1.52      print e
    1.53      sys.exit(1)
    1.54 @@ -622,10 +638,13 @@ for o,a in opts:
    1.55      if o=="-f":
    1.56          filter_file = True
    1.57  
    1.58 +    if o=="-r":
    1.59 +        source_root = os.path.abspath(a)
    1.60 +
    1.61  if filter_file:
    1.62      # Filter the specified file and print the result to stdout
    1.63      filename = string.join(args)
    1.64 -    filterFile(filename)
    1.65 +    filterFile(os.path.abspath(filename))
    1.66  else:
    1.67  
    1.68      if len(args)!=2: