cubicweb/devtools/devctl.py
changeset 11129 97095348b3ee
parent 11088 b62b9d78b533
parent 11057 0b59724cb3f2
child 11454 7770559e3945
equal deleted inserted replaced
11128:9b4de34ad394 11129:97095348b3ee
    40 from cubicweb.cwconfig import CubicWebNoAppConfiguration
    40 from cubicweb.cwconfig import CubicWebNoAppConfiguration
    41 from cubicweb.toolsutils import (SKEL_EXCLUDE, Command, copy_skeleton,
    41 from cubicweb.toolsutils import (SKEL_EXCLUDE, Command, copy_skeleton,
    42                                  underline_title)
    42                                  underline_title)
    43 from cubicweb.web.webconfig import WebConfiguration
    43 from cubicweb.web.webconfig import WebConfiguration
    44 from cubicweb.server.serverconfig import ServerConfiguration
    44 from cubicweb.server.serverconfig import ServerConfiguration
       
    45 
       
    46 
       
    47 STD_BLACKLIST = set(STD_BLACKLIST)
       
    48 STD_BLACKLIST.add('.tox')
       
    49 STD_BLACKLIST.add('test')
    45 
    50 
    46 
    51 
    47 class DevConfiguration(ServerConfiguration, WebConfiguration):
    52 class DevConfiguration(ServerConfiguration, WebConfiguration):
    48     """dummy config to get full library schema and appobjects for
    53     """dummy config to get full library schema and appobjects for
    49     a cube or for cubicweb (without a home)
    54     a cube or for cubicweb (without a home)
   451     schemapotstream = open(schemapot, 'w')
   456     schemapotstream = open(schemapot, 'w')
   452     generate_schema_pot(schemapotstream.write, cubedir)
   457     generate_schema_pot(schemapotstream.write, cubedir)
   453     schemapotstream.close()
   458     schemapotstream.close()
   454     print('TAL', end=' ')
   459     print('TAL', end=' ')
   455     tali18nfile = osp.join(tempdir, 'tali18n.py')
   460     tali18nfile = osp.join(tempdir, 'tali18n.py')
   456     ptfiles = find('.', ('.py', '.pt'), blacklist=STD_BLACKLIST+('test',))
   461     ptfiles = find('.', ('.py', '.pt'), blacklist=STD_BLACKLIST)
   457     extract_from_tal(ptfiles, tali18nfile)
   462     extract_from_tal(ptfiles, tali18nfile)
   458     print('Javascript')
   463     print('Javascript')
   459     jsfiles =  [jsfile for jsfile in find('.', '.js')
   464     jsfiles =  [jsfile for jsfile in find('.', '.js')
   460                 if osp.basename(jsfile).startswith('cub')]
   465                 if osp.basename(jsfile).startswith('cub')]
   461     if jsfiles:
   466     if jsfiles:
   466         # no pot file created if there are no string to translate
   471         # no pot file created if there are no string to translate
   467         if osp.exists(tmppotfile):
   472         if osp.exists(tmppotfile):
   468             potfiles.append(tmppotfile)
   473             potfiles.append(tmppotfile)
   469     print('-> creating cube-specific catalog')
   474     print('-> creating cube-specific catalog')
   470     tmppotfile = osp.join(tempdir, 'generated.pot')
   475     tmppotfile = osp.join(tempdir, 'generated.pot')
   471     cubefiles = find('.', '.py', blacklist=STD_BLACKLIST+('test',))
   476     cubefiles = find('.', '.py', blacklist=STD_BLACKLIST)
   472     cubefiles.append(tali18nfile)
   477     cubefiles.append(tali18nfile)
   473     cmd = ['xgettext', '--no-location', '--omit-header', '-k_', '-o', tmppotfile]
   478     cmd = ['xgettext', '--no-location', '--omit-header', '-k_', '-o', tmppotfile]
   474     cmd.extend(cubefiles)
   479     cmd.extend(cubefiles)
   475     execute2(cmd)
   480     execute2(cmd)
   476     if osp.exists(tmppotfile): # doesn't exists of no translation string found
   481     if osp.exists(tmppotfile): # doesn't exists of no translation string found