devtools/devctl.py
branchstable
changeset 5537 2889091bd1bf
parent 5534 b75aa6ce0c04
child 5545 25fd74c23f91
child 5608 f9ab62103ad4
--- a/devtools/devctl.py	Tue May 18 14:25:37 2010 +0200
+++ b/devtools/devctl.py	Tue May 18 14:26:19 2010 +0200
@@ -352,23 +352,23 @@
 
 def update_cubes_catalogs(cubes):
     for cubedir in cubes:
-        toedit = []
         if not isdir(cubedir):
             print '-> ignoring %s that is not a directory.' % cubedir
             continue
         try:
-            toedit += update_cube_catalogs(cubedir)
+            toedit = update_cube_catalogs(cubedir)
         except Exception:
             import traceback
             traceback.print_exc()
             print '-> error while updating catalogs for cube', cubedir
         else:
             # instructions pour la suite
-            print '-> regenerated .po catalogs for cube %s.' % cubedir
-            print '\nYou can now edit the following files:'
-            print '* ' + '\n* '.join(toedit)
-            print ('When you are done, run "cubicweb-ctl i18ninstance '
-                   '<yourinstance>" to see changes in your instances.')
+            if toedit:
+                print '-> regenerated .po catalogs for cube %s.' % cubedir
+                print '\nYou can now edit the following files:'
+                print '* ' + '\n* '.join(toedit)
+                print ('When you are done, run "cubicweb-ctl i18ninstance '
+                       '<yourinstance>" to see changes in your instances.')
 
 def update_cube_catalogs(cubedir):
     import shutil
@@ -376,7 +376,6 @@
     from logilab.common.fileutils import ensure_fs_mode
     from logilab.common.shellutils import find, rm
     from cubicweb.i18n import extract_from_tal, execute
-    toedit = []
     cube = basename(normpath(cubedir))
     tempdir = tempfile.mkdtemp()
     print underline_title('Updating i18n catalogs for cube %s' % cube)
@@ -421,8 +420,14 @@
     print '-> merging %i .pot files:' % len(potfiles)
     execute('msgcat -o %s %s' % (potfile,
                                  ' '.join('"%s"' % f for f in potfiles)))
+    if not exists(potfile):
+        print 'no message catalog for cube', cube, 'nothing to translate'
+        # cleanup
+        rm(tempdir)
+        return ()
     print '-> merging main pot file with existing translations:'
     chdir('i18n')
+    toedit = []
     for lang in LANGS:
         print '-> language', lang
         cubepo = '%s.po' % lang
@@ -521,6 +526,7 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 ''',
+
         'GPL': '''\
 # This program is free software: you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free Software