# HG changeset patch # User Sylvain Thénault # Date 1274185579 -7200 # Node ID 2889091bd1bfae421ec1e49e7c42a4b8375d0875 # Parent b7fba311e8d0d9d5ed23e92a9d92fe6e9ee4eaed [i18ncube] do not crash if cube has nothing to translate diff -r b7fba311e8d0 -r 2889091bd1bf devtools/devctl.py --- 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 ' - '" 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 ' + '" 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 . ''', + '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