[GRASS-SVN] r71838 - grass/trunk/locale

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 25 19:17:27 PST 2017


Author: wenzeslaus
Date: 2017-11-25 19:17:27 -0800 (Sat, 25 Nov 2017)
New Revision: 71838

Modified:
   grass/trunk/locale/grass_po_stats.py
Log:
fix most obvious Python 3 compatibility issues: tabs, has_key, print in po script (see #2708)

Modified: grass/trunk/locale/grass_po_stats.py
===================================================================
--- grass/trunk/locale/grass_po_stats.py	2017-11-26 03:00:40 UTC (rev 71837)
+++ grass/trunk/locale/grass_po_stats.py	2017-11-26 03:17:27 UTC (rev 71838)
@@ -14,6 +14,8 @@
 #
 #############################################################################
 
+from __future__ import print_function
+
 import os, sys
 import subprocess
 import json
@@ -33,7 +35,7 @@
         lang = lang[0].split('.')[0]
 
         # if keys is not in languages add it and the file's name
-        if not languages.has_key(lang):
+        if lang not in languages:
             languages[lang] = [pofile,]
         # add only files name
         else:
@@ -112,7 +114,7 @@
             # check if some errors occurs
             if msg.find('error') != -1:
                 # TODO CHECK IF grass.warning()
-                print "WARNING: file <%s> has some problems: <%s>" % (flang, msg)
+                print("WARNING: file <%s> has some problems: <%s>" % (flang, msg))
                 continue
             output['langs'][lang][fpref], lgood, lfuzzy, lbad = \
             read_msgfmt_statistics(msg, lgood, lfuzzy, lbad)
@@ -137,7 +139,7 @@
     try:
         os.remove("messages.mo")
     except:
-	pass
+        pass
 
 def main(in_dirpath, out_josonpath):
     languages = read_po_files(in_dirpath)



More information about the grass-commit mailing list