fix i18n catalog compilation tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 28 Apr 2009 15:36:04 +0200
branchtls-sprint
changeset 1502 e25be3c82947
parent 1501 c80ca83a382f
child 1503 5cc3afa14e4b
fix i18n catalog compilation
devtools/devctl.py
--- a/devtools/devctl.py	Tue Apr 28 14:37:19 2009 +0200
+++ b/devtools/devctl.py	Tue Apr 28 15:36:04 2009 +0200
@@ -93,8 +93,8 @@
         config = DevCubeConfiguration(cube)
         schema = config.load_schema()
     else:
+        config = libconfig
         schema = config.load_schema()
-        config = libconfig
         libconfig = None
     vreg = CubicWebRegistry(config)
     # set_schema triggers objects registrations
@@ -130,7 +130,7 @@
     w('# subject and object forms for each relation type\n')
     w('# (no object form for final relation types)\n')
     w('\n')
-    if libschema is not None:
+    if libconfig is not None:
         relations = [r for r in schema.relations() if not r in libschema]
     else:
         relations = schema.relations()
@@ -155,9 +155,13 @@
                 if rschema.is_final():
                     continue
                 for teschema in rschema.targets(eschema, role):
-                    if defined_in_library(libschema, eschema, rschema,
-                                          teschema, role):
-                        continue
+                    if libconfig is not None:
+                        if role == 'subject':
+                            subjtype, objtype = etype, tetype
+                        else:
+                            subjtype, objtype = tetype, etype
+                        if libschema.rschema(rtype).has_rdef(subjtype, objtype):
+                            continue
                     if actionbox.relation_mode(rschema, eschema, teschema, role) == 'create':
                         if role == 'subject':
                             label = 'add %s %s %s %s' % (eschema, rschema,
@@ -197,7 +201,7 @@
                     break
 
 
-def defined_in_library(libschema, etype, rtype, tetype, role):
+def defined_in_library(etype, rtype, tetype, role):
     """return true if the given relation definition exists in cubicweb's library
     """
     if libschema is None:
@@ -271,8 +275,12 @@
             cmd = 'xgettext --no-location --omit-header -k_ -o %s %s'
             if lang is not None:
                 cmd += ' -L %s' % lang
-            potfiles.append(join(tempdir, '%s.pot' % id))
-            execute(cmd % (potfiles[-1], ' '.join(files)))
+            potfile = join(tempdir, '%s.pot' % id)
+            execute(cmd % (potfile, ' '.join(files)))
+            if exists(potfile):
+                potfiles.append(potfile)
+            else:
+                print 'WARNING: %s file not generated' % potfile
         print '******** merging .pot files'
         cubicwebpot = join(tempdir, 'cubicweb.pot')
         execute('msgcat %s > %s' % (' '.join(potfiles), cubicwebpot))