conf: print is a function in Python 3
authorTobias Brunner <tobias@strongswan.org>
Tue, 13 May 2014 09:06:51 +0000 (11:06 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 13 May 2014 09:14:43 +0000 (11:14 +0200)
conf/format-options.py

index 7d67c98..5f850af 100755 (executable)
@@ -230,32 +230,32 @@ class ConfFormatter:
                if len(opt.desc):
                        self.__wrapper.initial_indent = '{0}# '.format(self.__indent * indent)
                        self.__wrapper.subsequent_indent = self.__wrapper.initial_indent
-                       print format(self.__wrapper.fill(self.__tags.replace(opt.desc[0])))
+                       print(self.__wrapper.fill(self.__tags.replace(opt.desc[0])))
 
        def __print_option(self, opt, indent, commented):
                """Print a single option with description and default value"""
                comment = "# " if commented or opt.commented else ""
                self.__print_description(opt, indent)
                if opt.default:
-                       print '{0}{1}{2} = {3}'.format(self.__indent * indent, comment, opt.name, opt.default)
+                       print('{0}{1}{2} = {3}'.format(self.__indent * indent, comment, opt.name, opt.default))
                else:
-                       print '{0}{1}{2} ='.format(self.__indent * indent, comment, opt.name)
-               print
+                       print('{0}{1}{2} ='.format(self.__indent * indent, comment, opt.name))
+               print('')
 
        def __print_section(self, section, indent, commented):
                """Print a section with all options"""
                commented = commented or section.commented
                comment = "# " if commented else ""
                self.__print_description(section, indent)
-               print '{0}{1}{2} {{'.format(self.__indent * indent, comment, section.name)
-               print
+               print('{0}{1}{2} {{'.format(self.__indent * indent, comment, section.name))
+               print('')
                for o in sorted(section.options, key=attrgetter('section')):
                        if o.section:
                                self.__print_section(o, indent + 1, commented)
                        else:
                                self.__print_option(o, indent + 1, commented)
-               print '{0}{1}}}'.format(self.__indent * indent, comment)
-               print
+               print('{0}{1}}}'.format(self.__indent * indent, comment))
+               print('')
 
        def format(self, options):
                """Print a list of options"""
@@ -286,14 +286,14 @@ class ManFormatter:
                if option.section and not len(option.desc):
                        return
                if option.section:
-                       print '.TP\n.B {0}\n.br'.format(option.fullname)
+                       print('.TP\n.B {0}\n.br'.format(option.fullname))
                else:
-                       print '.TP'
+                       print('.TP')
                        default = option.default if option.default else ''
-                       print '.BR {0} " [{1}]"'.format(option.fullname, default)
+                       print('.BR {0} " [{1}]"'.format(option.fullname, default))
                for para in option.desc if len(option.desc) < 2 else option.desc[1:]:
-                       print self.__groffize(self.__wrapper.fill(para))
-                       print ''
+                       print(self.__groffize(self.__wrapper.fill(para)))
+                       print('')
 
        def format(self, options):
                """Print a list of options"""