91 cleanup_sys_modules(libconfig) |
91 cleanup_sys_modules(libconfig) |
92 if cubedir: |
92 if cubedir: |
93 config = DevCubeConfiguration(cube) |
93 config = DevCubeConfiguration(cube) |
94 schema = config.load_schema() |
94 schema = config.load_schema() |
95 else: |
95 else: |
|
96 config = libconfig |
96 schema = config.load_schema() |
97 schema = config.load_schema() |
97 config = libconfig |
|
98 libconfig = None |
98 libconfig = None |
99 vreg = CubicWebRegistry(config) |
99 vreg = CubicWebRegistry(config) |
100 # set_schema triggers objects registrations |
100 # set_schema triggers objects registrations |
101 vreg.set_schema(schema) |
101 vreg.set_schema(schema) |
102 w(DEFAULT_POT_HEAD) |
102 w(DEFAULT_POT_HEAD) |
128 done.add(eschema.description) |
128 done.add(eschema.description) |
129 add_msg(w, eschema.description) |
129 add_msg(w, eschema.description) |
130 w('# subject and object forms for each relation type\n') |
130 w('# subject and object forms for each relation type\n') |
131 w('# (no object form for final relation types)\n') |
131 w('# (no object form for final relation types)\n') |
132 w('\n') |
132 w('\n') |
133 if libschema is not None: |
133 if libconfig is not None: |
134 relations = [r for r in schema.relations() if not r in libschema] |
134 relations = [r for r in schema.relations() if not r in libschema] |
135 else: |
135 else: |
136 relations = schema.relations() |
136 relations = schema.relations() |
137 for rschema in sorted(set(relations)): |
137 for rschema in sorted(set(relations)): |
138 rtype = rschema.type |
138 rtype = rschema.type |
153 ('object', eschema.object_relations())): |
153 ('object', eschema.object_relations())): |
154 for rschema in rschemas: |
154 for rschema in rschemas: |
155 if rschema.is_final(): |
155 if rschema.is_final(): |
156 continue |
156 continue |
157 for teschema in rschema.targets(eschema, role): |
157 for teschema in rschema.targets(eschema, role): |
158 if defined_in_library(libschema, eschema, rschema, |
158 if libconfig is not None: |
159 teschema, role): |
159 if role == 'subject': |
160 continue |
160 subjtype, objtype = etype, tetype |
|
161 else: |
|
162 subjtype, objtype = tetype, etype |
|
163 if libschema.rschema(rtype).has_rdef(subjtype, objtype): |
|
164 continue |
161 if actionbox.relation_mode(rschema, eschema, teschema, role) == 'create': |
165 if actionbox.relation_mode(rschema, eschema, teschema, role) == 'create': |
162 if role == 'subject': |
166 if role == 'subject': |
163 label = 'add %s %s %s %s' % (eschema, rschema, |
167 label = 'add %s %s %s %s' % (eschema, rschema, |
164 teschema, role) |
168 teschema, role) |
165 label2 = "creating %s (%s %%(linkto)s %s %s)" % ( |
169 label2 = "creating %s (%s %%(linkto)s %s %s)" % ( |
195 yield objid |
199 yield objid |
196 done.add(objid) |
200 done.add(objid) |
197 break |
201 break |
198 |
202 |
199 |
203 |
200 def defined_in_library(libschema, etype, rtype, tetype, role): |
204 def defined_in_library(etype, rtype, tetype, role): |
201 """return true if the given relation definition exists in cubicweb's library |
205 """return true if the given relation definition exists in cubicweb's library |
202 """ |
206 """ |
203 if libschema is None: |
207 if libschema is None: |
204 return False |
208 return False |
205 if role == 'subject': |
209 if role == 'subject': |
269 ('js', globfind(join(BASEDIR, 'web'), 'cub*.js'), 'java'), |
273 ('js', globfind(join(BASEDIR, 'web'), 'cub*.js'), 'java'), |
270 ]: |
274 ]: |
271 cmd = 'xgettext --no-location --omit-header -k_ -o %s %s' |
275 cmd = 'xgettext --no-location --omit-header -k_ -o %s %s' |
272 if lang is not None: |
276 if lang is not None: |
273 cmd += ' -L %s' % lang |
277 cmd += ' -L %s' % lang |
274 potfiles.append(join(tempdir, '%s.pot' % id)) |
278 potfile = join(tempdir, '%s.pot' % id) |
275 execute(cmd % (potfiles[-1], ' '.join(files))) |
279 execute(cmd % (potfile, ' '.join(files))) |
|
280 if exists(potfile): |
|
281 potfiles.append(potfile) |
|
282 else: |
|
283 print 'WARNING: %s file not generated' % potfile |
276 print '******** merging .pot files' |
284 print '******** merging .pot files' |
277 cubicwebpot = join(tempdir, 'cubicweb.pot') |
285 cubicwebpot = join(tempdir, 'cubicweb.pot') |
278 execute('msgcat %s > %s' % (' '.join(potfiles), cubicwebpot)) |
286 execute('msgcat %s > %s' % (' '.join(potfiles), cubicwebpot)) |
279 print '******** merging main pot file with existing translations' |
287 print '******** merging main pot file with existing translations' |
280 chdir(I18NDIR) |
288 chdir(I18NDIR) |