mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
36 lines
1.2 KiB
Python
Executable file
36 lines
1.2 KiB
Python
Executable file
#!/usr/bin/python
|
|
|
|
import os, glob, subprocess, shlex
|
|
|
|
components = ('core', 'declarative', 'gui', 'multimedia', 'network', 'opengl',
|
|
'plugins', 'script', 'scripttools', 'sql', 'svg', 'xml', 'xmlpatterns')
|
|
tools = ('lrelease', 'uic', 'moc', 'lupdate', 'idc', 'qcollectiongenerator',
|
|
'rcc', 'lconvert', 'qhelpgenerator', 'qdbus')
|
|
cfiles = []
|
|
tfiles = []
|
|
|
|
def list_files(sdir):
|
|
lfiles = []
|
|
for root, subdirs, files in os.walk(sdir):
|
|
for sfile in files:
|
|
if sfile.endswith(('.cpp', '.h', '.js', '.qs', '.qml', '.ui')):
|
|
lfiles.append('%s/%s' % (root, sfile))
|
|
return lfiles
|
|
|
|
for c in components:
|
|
cfiles.extend(list_files('src/%s' % c))
|
|
|
|
for t in tools:
|
|
tfiles.extend(list_files('src/tools/%s' % t))
|
|
|
|
for t in glob.glob('translations/qt*.ts'):
|
|
if 'tools' in t:
|
|
files = ' '.join(tfiles)
|
|
else:
|
|
files = ' '.join(cfiles)
|
|
command = 'build/bin/lupdate -locations relative -no-ui-lines -no-obsolete %s -ts %s' % (files, t)
|
|
command = shlex.split(command)
|
|
pipe = subprocess.Popen(command, stderr=subprocess.PIPE)
|
|
pipe.wait()
|
|
if pipe.returncode != 0:
|
|
raise(Exception(pipe.communicate()[1].strip()))
|