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

Phillip Sz phillip.szelat at gmail.com
Wed May 18 10:18:44 UTC 2016


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

New commits:
commit 1dec3cb29bd7ec028d6b2139d0199225b5cf5d67
Author: Phillip Sz <phillip.szelat at gmail.com>
Date:   Wed May 18 11:38:53 2016 +0200

    find-german-comments: let's use python 3
    
    Under python 3 we must use bytes.
    
    Change-Id: I86d2a875f4e06a9cb9724d86348f420bb8ea19e9
    Reviewed-on: https://gerrit.libreoffice.org/25084
    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 53dbd1d..86dfe547 100755
--- a/bin/find-german-comments
+++ b/bin/find-german-comments
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 ########################################################################
 #
 #  Copyright (c) 2010 Jonas Jensen, Miklos Vajna
@@ -131,8 +131,8 @@ class Parser:
         unsure, just don't warn, there are strings where you just can't
         teremine the results reliably, like '#110680#' """
 
-        self.text_cat.stdin.write(s)
-        self.text_cat.stdin.write("\n")
+        self.text_cat.stdin.write(bytes(s, 'utf-8'))
+        self.text_cat.stdin.write(bytes("\n", 'utf-8'))
         self.text_cat.stdin.flush()
         lang = self.text_cat.stdout.readline().strip()
         return lang
@@ -146,7 +146,7 @@ class Parser:
         s = s.replace('\n', ' ')
         if len(s) < 32 or len(s.split()) < 4:
             return False
-        return "german" == self.get_lang(s)
+        return b"german" == self.get_lang(s)
 
     def check_file(self, path):
         """


More information about the Libreoffice-commits mailing list