2015-12-29 11:30:14 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import os, glob, subprocess, shlex
|
|
|
|
|
2016-01-09 12:55:18 +02:00
|
|
|
components = ('core', 'declarative', 'gui', 'multimedia', 'network', 'opengl',
|
2016-10-15 04:19:32 +00:00
|
|
|
'plugins', 'script', 'scripttools', 'sql', 'svg', 'xml', 'designer')
|
|
|
|
tools = ('lrelease', 'uic', 'moc', 'lupdate', 'rcc', 'lconvert', 'qdbus',
|
|
|
|
'designer', 'qdbusviewer', 'qscript', 'qtconfig')
|
2015-12-29 11:30:14 +02:00
|
|
|
cfiles = []
|
|
|
|
tfiles = []
|
|
|
|
|
|
|
|
def list_files(sdir):
|
2016-01-09 12:55:18 +02:00
|
|
|
lfiles = []
|
2015-12-29 11:30:14 +02:00
|
|
|
for root, subdirs, files in os.walk(sdir):
|
|
|
|
for sfile in files:
|
2016-01-12 23:09:40 +02:00
|
|
|
if sfile.endswith(('.cpp', '.h', '.js', '.qs', '.qml', '.ui')):
|
2016-01-09 12:55:18 +02:00
|
|
|
lfiles.append('%s/%s' % (root, sfile))
|
|
|
|
return lfiles
|
2015-12-29 11:30:14 +02:00
|
|
|
|
|
|
|
for c in components:
|
2016-01-11 17:42:52 +02:00
|
|
|
cfiles.extend(list_files('src/%s' % c))
|
2015-12-29 11:30:14 +02:00
|
|
|
|
|
|
|
for t in tools:
|
2016-01-11 17:42:52 +02:00
|
|
|
tfiles.extend(list_files('src/tools/%s' % t))
|
2015-12-29 11:30:14 +02:00
|
|
|
|
|
|
|
for t in glob.glob('translations/qt*.ts'):
|
|
|
|
if 'tools' in t:
|
2015-12-30 10:44:42 +02:00
|
|
|
files = ' '.join(tfiles)
|
2015-12-29 11:30:14 +02:00
|
|
|
else:
|
2015-12-30 10:44:42 +02:00
|
|
|
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()))
|