fixes for Python 2.6 compatibility
authorGustavo Carneiro <gjcarneiro@gmail.com>
Thu, 13 Mar 2014 07:53:32 -0700
changeset 10660 0865638cacc9
parent 10659 0ae847ef07a9
child 10661 06fbdb895376
fixes for Python 2.6 compatibility
bindings/python/ns3modulegen_core_customizations.py
--- a/bindings/python/ns3modulegen_core_customizations.py	Thu Mar 13 06:37:41 2014 -0700
+++ b/bindings/python/ns3modulegen_core_customizations.py	Thu Mar 13 07:53:32 2014 -0700
@@ -28,13 +28,13 @@
     def __init__(self):
         super(SmartPointerTransformation, self).__init__()
         self.rx = re.compile(r'(ns3::|::ns3::|)Ptr<([^>]+)>\s*$')
-        print("{!r}".format(self), file=sys.stderr)
+        print("{0!r}".format(self), file=sys.stderr)
 
     def _get_untransformed_type_traits(self, name):
         m = self.rx.match(name)
         is_const = False
         if m is None:
-            print("{!r} did not match".format(name), file=sys.stderr)
+            print("{0!r} did not match".format(name), file=sys.stderr)
             return None, False
         else:
             name1 = m.group(2).strip()
@@ -65,9 +65,9 @@
         ## fix the ctype, add ns3:: namespace
         orig_ctype, is_const = self._get_untransformed_type_traits(args[0])
         if is_const:
-            correct_ctype = 'ns3::Ptr< {} const >'.format(orig_ctype[:-2])
+            correct_ctype = 'ns3::Ptr< {0} const >'.format(orig_ctype[:-2])
         else:
-            correct_ctype = 'ns3::Ptr< {} >'.format(orig_ctype[:-2])
+            correct_ctype = 'ns3::Ptr< {0} >'.format(orig_ctype[:-2])
         args = tuple([correct_ctype] + list(args[1:]))
 
         handler = type_handler(*args, **kwargs)