[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40681] trunk/blender/po: making PO/POT/.. .

Dalai Felinto dfelinto at gmail.com
Thu Sep 29 08:34:59 CEST 2011


Revision: 40681
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40681
Author:   dfelinto
Date:     2011-09-29 06:34:58 +0000 (Thu, 29 Sep 2011)
Log Message:
-----------
making PO/POT/... update scripts py3.2 compatible + making it almost win compatible

Adding from codecs import open + the encoding in update_pot.py so it works for python 3.2.
Now it should be easier to replace the executable folders in the first lines of the file.
It now also works if you are in the same folder as the .po files (i.e. os.path.dirname(__FILE__) is empty)

It's still not working for me on Mingw because I need gettext 1.8 and so far I found only the 1.7
(in 1.7 msgmerge --lang is not supported)

Modified Paths:
--------------
    trunk/blender/po/update_mo.py
    trunk/blender/po/update_msg.py
    trunk/blender/po/update_po.py
    trunk/blender/po/update_pot.py

Modified: trunk/blender/po/update_mo.py
===================================================================
--- trunk/blender/po/update_mo.py	2011-09-29 06:15:33 UTC (rev 40680)
+++ trunk/blender/po/update_mo.py	2011-09-29 06:34:58 UTC (rev 40681)
@@ -27,7 +27,8 @@
 import os
 import sys
 
-CURRENT_DIR = os.path.dirname(__file__)
+GETTEXT_MSGFMT_EXECUTABLE = "msgfmt"
+CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
 SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, "..")))
 LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "bin", ".blender", "locale")
 
@@ -38,7 +39,7 @@
     lang = os.path.basename(po)[:-3]
 
     # show stats
-    cmd = ("msgfmt",
+    cmd = (GETTEXT_MSGFMT_EXECUTABLE,
         "--statistics",
         os.path.join(CURRENT_DIR, "%s.po" % lang),
         "-o",

Modified: trunk/blender/po/update_msg.py
===================================================================
--- trunk/blender/po/update_msg.py	2011-09-29 06:15:33 UTC (rev 40680)
+++ trunk/blender/po/update_msg.py	2011-09-29 06:34:58 UTC (rev 40681)
@@ -26,7 +26,7 @@
 
 import os
 
-CURRENT_DIR = os.path.dirname(__file__)
+CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
 SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, "..")))
 
 FILE_NAME_MESSAGES = os.path.join(CURRENT_DIR, "messages.txt")

Modified: trunk/blender/po/update_po.py
===================================================================
--- trunk/blender/po/update_po.py	2011-09-29 06:15:33 UTC (rev 40680)
+++ trunk/blender/po/update_po.py	2011-09-29 06:34:58 UTC (rev 40681)
@@ -27,7 +27,8 @@
 import os
 import sys
 
-CURRENT_DIR = os.path.dirname(__file__)
+GETTEXT_MSGMERGE_EXECUTABLE = "msgmerge"
+CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
 DOMAIN = "blender"
 
 
@@ -35,7 +36,7 @@
     lang = os.path.basename(po)[:-3]
 
     # update po file
-    cmd = ("msgmerge",
+    cmd = (GETTEXT_MSGMERGE_EXECUTABLE,
            "--update",
            "--lang=%s" % lang,
            os.path.join(CURRENT_DIR, "%s.po" % lang),

Modified: trunk/blender/po/update_pot.py
===================================================================
--- trunk/blender/po/update_pot.py	2011-09-29 06:15:33 UTC (rev 40680)
+++ trunk/blender/po/update_pot.py	2011-09-29 06:34:58 UTC (rev 40681)
@@ -25,9 +25,10 @@
 
 import subprocess
 import os
+from codecs import open
 
 GETTEXT_XGETTEXT_EXECUTABLE = "xgettext"
-CURRENT_DIR = os.path.dirname(__file__)
+CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
 SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, "..")))
 DOMAIN = "blender"
 
@@ -55,7 +56,7 @@
     pot_messages = {}
     reading_message = False
     message = ""
-    with open(FILE_NAME_POT, 'r') as handle:
+    with open(FILE_NAME_POT, 'r', "utf-8") as handle:
         while True:
             line = handle.readline()
 
@@ -73,8 +74,8 @@
                 message += line[1:-1]
 
     # add messages collected automatically from RNA
-    with open(FILE_NAME_POT, "a") as pot_handle:
-        with open(FILE_NAME_MESSAGES, 'r') as handle:
+    with open(FILE_NAME_POT, "a", "utf-8") as pot_handle:
+        with open(FILE_NAME_MESSAGES, 'r', "utf-8") as handle:
             while True:
                 line = handle.readline()
 




More information about the Bf-blender-cvs mailing list