[Checkins] SVN: cc.gettext/trunk/ Use python-gettext instead of forking to msgfmt.

Nathan Yergler nathan at yergler.net
Wed Aug 1 18:58:52 EDT 2007


Log message for revision 78535:
  Use python-gettext instead of forking to msgfmt.

Changed:
  U   cc.gettext/trunk/CHANGES.txt
  U   cc.gettext/trunk/cc/gettext/__init__.py
  U   cc.gettext/trunk/setup.py

-=-
Modified: cc.gettext/trunk/CHANGES.txt
===================================================================
--- cc.gettext/trunk/CHANGES.txt	2007-08-01 22:25:10 UTC (rev 78534)
+++ cc.gettext/trunk/CHANGES.txt	2007-08-01 22:58:51 UTC (rev 78535)
@@ -1,4 +1,7 @@
+0.6
+===
 
+Use python-gettext instead of forking a process to run msgfmt.
 
 0.5.1
 =====

Modified: cc.gettext/trunk/cc/gettext/__init__.py
===================================================================
--- cc.gettext/trunk/cc/gettext/__init__.py	2007-08-01 22:25:10 UTC (rev 78534)
+++ cc.gettext/trunk/cc/gettext/__init__.py	2007-08-01 22:58:51 UTC (rev 78535)
@@ -15,9 +15,9 @@
 """
 
 import os
-import subprocess
 import logging
 import zc.buildout
+from pythongettext.msgfmt import Msgfmt
 
 class PoFile(object):
     """Helper class to extract metadata from a PO File."""
@@ -50,13 +50,11 @@
     def language(self):
         return self.header['Language-code']
     
-class MsgFmt:
+class MsgFmtRecipe:
 
     def __init__(self, buildout, name, options):
 
         self.name, self.buildout, self.options = buildout, name, options
-
-        # XXX make sure msgfmt is available
         
         # perform sanity checking on parameters
         if 'po_path' not in options:
@@ -114,7 +112,7 @@
                     os.makedirs(os.path.dirname(mo_fn))
                 
                 # run msgfmt for each .po file
-                subprocess.call(['msgfmt', '-o', mo_fn, po_file.filename])
+                file(mo_fn, 'wb').write(Msgfmt(po_file.filename).get())
                 paths.append(mo_fn)
                 
         return paths

Modified: cc.gettext/trunk/setup.py
===================================================================
--- cc.gettext/trunk/setup.py	2007-08-01 22:25:10 UTC (rev 78534)
+++ cc.gettext/trunk/setup.py	2007-08-01 22:58:51 UTC (rev 78535)
@@ -22,15 +22,18 @@
 
 setup(
     name = "cc.gettext",
-    version = "0.5.1",
+    version = "0.6",
     packages = find_packages('.'),
-
+    namespace_packages = ['cc',],
+    
     # scripts and dependencies
     install_requires = ['setuptools',
                         'zc.buildout',
+                        'python-gettext',
                         ],
+    setup_requires=['python-gettext'],
 
-    entry_points = {'zc.buildout':['msgfmt = cc.gettext:MsgFmt'],
+    entry_points = {'zc.buildout':['msgfmt = cc.gettext:MsgFmtRecipe'],
                     },
     
     # author metadata



More information about the Checkins mailing list