[Libreoffice-commits] core.git: bin/find-german-comments

Phillip Sz phillip.szelat at gmail.com
Wed May 18 08:59:03 UTC 2016


 bin/find-german-comments |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 95fecb5f6df6e7be917cc7cd14fe705b4a08a21d
Author: Phillip Sz <phillip.szelat at gmail.com>
Date:   Tue May 17 16:44:50 2016 +0200

    find-german-comments: make it work on arch
    
    Make this script work on systems, where python3 is default.
    Also give it a better coding style.
    
    Change-Id: I09bf72298c2a736266f1bdfc8572cc3e65d7d3d9
    Reviewed-on: https://gerrit.libreoffice.org/25068
    Tested-by: jan iversen <jani at documentfoundation.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/bin/find-german-comments b/bin/find-german-comments
index b067d9d..53dbd1d 100755
--- a/bin/find-german-comments
+++ b/bin/find-german-comments
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 ########################################################################
 #
 #  Copyright (c) 2010 Jonas Jensen, Miklos Vajna
@@ -177,7 +177,7 @@ class Parser:
                     sys.stderr.write("%s ... %s positives\n" % (path, str(len(path_linenums))))
                     return
                 if len(path) + (len(path_linenums)*4) > 75:
-                    print "%s:\n" % path
+                    print("%s:\n" % path)
                     while(path_linenums):
                         i = 0
                         numline = []
@@ -189,16 +189,16 @@ class Parser:
                                 i = 10
                             i += 1
                         numline = [str(i) for i in numline]
-                        print "%s%s" % (TABS, ",".join(numline))
+                        print("%s%s" % (TABS, ",".join(numline)))
                 else:
                     if self.options.line_numbers:
                         path_linenums = [str(i) for i in path_linenums]
-                        print "%s:%s%s" % (path, "\t"*tab_calc(path), ",".join(path_linenums))
+                        print("%s:%s%s" % (path, "\t"*tab_calc(path), ",".join(path_linenums)))
 
         elif not self.options.filenames_only:
             for linenum, s in self.get_comments(path):
                 if self.is_german(s):
-                    print "%s:%s: %s" % (path, linenum, s)
+                    print("%s:%s: %s" % (path, linenum, s))
         else:
             fnames = set([])
             for linenum, s in self.get_comments(path):
@@ -207,7 +207,7 @@ class Parser:
                     fnames.add(path)
             # Print the filenames
             for f in fnames:
-                print f
+                print(f)
 
     def first_elem(self, path):
         lastElem = os.path.dirname(path)
@@ -377,7 +377,7 @@ class Parser:
 try:
     Parser()
 except KeyboardInterrupt:
-    print "Interrupted!"
+    print("Interrupted!")
     sys.exit(0)
 
 # vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list