Fixed python3 bindings generation.
authorMichel Zou <xantares09@hotmail.com>
Tue, 15 Jan 2013 15:13:42 +0000 (16:13 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 15 Jan 2013 16:52:42 +0000 (17:52 +0100)
bindings/doxy2swig.py

index c6c972c..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')
@@ -281,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
 
@@ -373,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))