Python3 patch for spew-svn-command-options.txt

Daniel Sahlberg daniel.l.sahlberg at gmail.com
Sat Oct 16 19:30:32 UTC 2021


Hi,

I tried to run spew-svn-command-options under Python3. I believe I've fixed
it but I would appreciate if someone with more Python experience could
check it. Feel free to commit it or to give +1 and I can commit it myself.

Thanks in advance!

Kind regards,
Daniel Sahlberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.red-bean.com/pipermail/svnbook-dev/attachments/20211016/7cc0bbe5/attachment.htm>
-------------- next part --------------
Index: spew-svn-command-options
===================================================================
--- spew-svn-command-options	(revision 6048)
+++ spew-svn-command-options	(working copy)
@@ -15,7 +15,7 @@
             break
         if line[3] == ' ':
             continue
-        option_parts = filter(None, line.split(' '))
+        option_parts = list(filter(None, line.split(' ')))
         if option_parts[0].startswith('--'):
             option = option_parts[0]
         else:
@@ -49,7 +49,7 @@
             continue
         if not line:
             break
-        subcommand = filter(None, line.split(' '))[0]
+        subcommand = next(filter(None, line.split(' ')))
         subcommands.append(subcommand)
 
     # For each subcommand, find the options.
@@ -59,15 +59,15 @@
             lines = os.popen("%s help %s" %
                              (tool, subcommand), 'r').readlines()
             options = find_options(lines)
-            print "%s %s" % (os.path.basename(tool), subcommand)
+            print("%s %s" % (os.path.basename(tool), subcommand))
             options.sort()
             for option in options:
-                print "%s %s %s" % (os.path.basename(tool), subcommand, option)
+                print("%s %s %s" % (os.path.basename(tool), subcommand, option))
     else:
         lines = os.popen("%s --help" % (tool), 'r').readlines()
         options = find_options(lines)
-        print "%s" % (os.path.basename(tool))
+        print("%s" % (os.path.basename(tool)))
         options.sort()
         for option in options:
-            print "%s %s" % (os.path.basename(tool), option)
+            print("%s %s" % (os.path.basename(tool), option))
         


More information about the svnbook-dev mailing list