diff mbox

[ovs-dev] xml2nroff: Port to python3.

Message ID 20170106020108.7507-1-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer Jan. 6, 2017, 2:01 a.m. UTC
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 build-aux/xml2nroff | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Ben Pfaff Jan. 6, 2017, 4:08 a.m. UTC | #1
On Thu, Jan 05, 2017 at 06:01:08PM -0800, Joe Stringer wrote:
> Signed-off-by: Joe Stringer <joe@ovn.org>

Works for me.

Acked-by: Ben Pfaff <blp@ovn.org>
Joe Stringer Jan. 6, 2017, 8:40 p.m. UTC | #2
On 5 January 2017 at 20:08, Ben Pfaff <blp@ovn.org> wrote:
> On Thu, Jan 05, 2017 at 06:01:08PM -0800, Joe Stringer wrote:
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>
> Works for me.
>
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks. I also added this file to FLAKE8_PYFILES to prevent
regression, and pushed this to master.
diff mbox

Patch

diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff
index df1df28d56cc..bd4e87928e4f 100755
--- a/build-aux/xml2nroff
+++ b/build-aux/xml2nroff
@@ -24,7 +24,7 @@  argv0 = sys.argv[0]
 
 
 def usage():
-    print """\
+    print("""\
 %(argv0)s: XML to nroff converter
 Converts the XML format supplied as input into an nroff-formatted manpage.
 usage: %(argv0)s [OPTIONS] INPUT.XML [VAR=VALUE]...
@@ -37,14 +37,14 @@  The following options are also available:
   -I, --include=DIR           search DIR for include files (default: .)
   --version=VERSION           use VERSION to display on document footer
   -h, --help                  display this help message\
-""" % {'argv0': argv0}
+""" % {'argv0': argv0})
     sys.exit(0)
 
 
 def manpage_to_nroff(xml_file, subst, include_path, version=None):
     with open(xml_file) as f:
         content = f.read()
-    for k, v in subst.iteritems():
+    for k, v in subst.items():
         content = content.replace(k, v)
     doc = xml.dom.minidom.parseString(content).documentElement
 
@@ -62,7 +62,7 @@  def manpage_to_nroff(xml_file, subst, include_path, version=None):
             sys.stderr.write("%s: could not open include file %s\n"
                              % (argv0, fn))
             sys.exit(1)
-        for k, v in subst.iteritems():
+        for k, v in subst.items():
             content = content.replace(k, v)
         xi_doc = xml.dom.minidom.parseString(content).documentElement
         doc.replaceChild(xi_doc, node)
@@ -102,7 +102,7 @@  if __name__ == "__main__":
     try:
         options, args = getopt.gnu_getopt(sys.argv[1:], 'hVI:',
                                           ['version=', 'help', 'include='])
-    except getopt.GetoptError, geo:
+    except getopt.GetoptError as geo:
         sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
         sys.exit(1)
 
@@ -139,13 +139,13 @@  if __name__ == "__main__":
 
     try:
         s = manpage_to_nroff(args[0], subst, include_path, version)
-    except build.nroff.error.Error, e:
+    except build.nroff.error.Error as e:
         sys.stderr.write("%s: %s\n" % (argv0, e.msg))
         sys.exit(1)
     for line in s.splitlines():
         line = line.strip()
         if line:
-            print line
+            print(line)
 
 
 # Local variables: