252 def run(self, args): |
252 def run(self, args): |
253 """run the command with its specific arguments""" |
253 """run the command with its specific arguments""" |
254 if args: |
254 if args: |
255 raise BadCommandUsage('Too much arguments') |
255 raise BadCommandUsage('Too much arguments') |
256 import shutil |
256 import shutil |
257 from tempfile import mktemp |
257 import tempfile |
258 import yams |
258 import yams |
259 from logilab.common.fileutils import ensure_fs_mode |
259 from logilab.common.fileutils import ensure_fs_mode |
260 from logilab.common.shellutils import globfind, find, rm |
260 from logilab.common.shellutils import globfind, find, rm |
261 from cubicweb.common.i18n import extract_from_tal, execute |
261 from cubicweb.common.i18n import extract_from_tal, execute |
262 tempdir = mktemp() |
262 tempdir = tempdir.mkdtemp() |
263 mkdir(tempdir) |
|
264 potfiles = [join(I18NDIR, 'entities.pot')] |
263 potfiles = [join(I18NDIR, 'entities.pot')] |
265 print '******** extract schema messages' |
264 print '******** extract schema messages' |
266 schemapot = join(tempdir, 'schema.pot') |
265 schemapot = join(tempdir, 'schema.pot') |
267 potfiles.append(schemapot) |
266 potfiles.append(schemapot) |
268 # explicit close necessary else the file may not be yet flushed when |
267 # explicit close necessary else the file may not be yet flushed when |
346 print '* ' + '\n* '.join(toedit) |
345 print '* ' + '\n* '.join(toedit) |
347 |
346 |
348 |
347 |
349 def update_cube_catalogs(cubedir): |
348 def update_cube_catalogs(cubedir): |
350 import shutil |
349 import shutil |
351 from tempfile import mktemp |
350 import tempfile |
352 from logilab.common.fileutils import ensure_fs_mode |
351 from logilab.common.fileutils import ensure_fs_mode |
353 from logilab.common.shellutils import find, rm |
352 from logilab.common.shellutils import find, rm |
354 from cubicweb.common.i18n import extract_from_tal, execute |
353 from cubicweb.common.i18n import extract_from_tal, execute |
355 toedit = [] |
354 toedit = [] |
356 cube = basename(normpath(cubedir)) |
355 cube = basename(normpath(cubedir)) |
357 tempdir = mktemp() |
356 tempdir = tempfile.mkdtemp() |
358 mkdir(tempdir) |
|
359 print '*' * 72 |
357 print '*' * 72 |
360 print 'updating %s cube...' % cube |
358 print 'updating %s cube...' % cube |
361 chdir(cubedir) |
359 chdir(cubedir) |
362 potfiles = [join('i18n', scfile) for scfile in ('entities.pot',) |
360 potfiles = [join('i18n', scfile) for scfile in ('entities.pot',) |
363 if exists(join('i18n', scfile))] |
361 if exists(join('i18n', scfile))] |