Change default build type to optimized build with debug symbols (RelWithDebInfo)
[libftdi] / bindings / doxy2swig.py
index 96573dc..cf4c52b 100644 (file)
@@ -33,7 +33,6 @@ from xml.dom import minidom
 import re
 import textwrap
 import sys
-import types
 import os.path
 import optparse
 
@@ -150,7 +149,7 @@ class Doxy2SWIG:
 
     def add_text(self, value):
         """Adds text corresponding to `value` into `self.pieces`."""
-        if type(value) in (types.ListType, types.TupleType):
+        if isinstance(value, (list, tuple)):
             self.pieces.extend(value)
         else:
             self.pieces.append(value)
@@ -210,7 +209,7 @@ class Doxy2SWIG:
         kind = node.attributes['kind'].value
         if kind in ('class', 'struct'):
             prot = node.attributes['prot'].value
-            if prot <> 'public':
+            if prot != 'public':
                 return
             names = ('compoundname', 'briefdescription',
                      'detaileddescription', 'includes')
@@ -237,6 +236,7 @@ class Doxy2SWIG:
             if key == 'kind':
                 if val == 'param': text = 'Parameters'
                 elif val == 'exception': text = 'Exceptions'
+                elif val == 'retval': text = 'Returns'
                 else: text = val
                 break
         self.add_text(['\n', '\n', text, ':', '\n'])
@@ -280,7 +280,7 @@ class Doxy2SWIG:
             if name[:8] == 'operator': # Don't handle operators yet.
                 return
 
-            if not first.has_key('definition') or \
+            if not 'definition' in first or \
                    kind in ['variable', 'typedef']:
                 return
 
@@ -372,7 +372,7 @@ class Doxy2SWIG:
             if not os.path.exists(fname):
                 fname = os.path.join(self.my_dir,  fname)
             if not self.quiet:
-                print "parsing file: %s"%fname
+                print( "parsing file: %s"%fname )
             p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
             p.generate()
             self.pieces.extend(self.clean_pieces(p.pieces))
@@ -410,8 +410,8 @@ class Doxy2SWIG:
         _data = "".join(ret)
         ret = []
         for i in _data.split('\n\n'):
-            if i == 'Parameters:' or i == 'Exceptions:':
-                ret.extend([i, '\n-----------', '\n\n'])
+            if i == 'Parameters:' or i == 'Exceptions:' or i == 'Returns:':
+                ret.extend([i, '\n'+'-'*len(i), '\n\n'])
             elif i.find('// File:') > -1: # leave comments alone.
                 ret.extend([i, '\n'])
             else: