2015-12-29 11:30:14 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import os, glob, subprocess, shlex
|
|
|
|
|
2017-04-26 13:10:13 +00:00
|
|
|
components = ('core', 'dbus', 'declarative', 'gui', 'network', 'plugins',
|
|
|
|
'script', 'scripttools', 'sql', 'svg', 'test', 'uitools', 'xml')
|
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
|
|
|
|
2016-10-25 02:47:12 +00:00
|
|
|
for t in glob.glob('src/tools/*'):
|
|
|
|
tfiles.extend(list_files(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)
|
2017-08-09 06:31:01 +00:00
|
|
|
command = 'fastdev/bin/lupdate -locations relative -no-ui-lines -no-obsolete %s -ts %s' % (files, t)
|
2015-12-30 10:44:42 +02:00
|
|
|
command = shlex.split(command)
|
|
|
|
pipe = subprocess.Popen(command, stderr=subprocess.PIPE)
|
|
|
|
pipe.wait()
|
|
|
|
if pipe.returncode != 0:
|
|
|
|
raise(Exception(pipe.communicate()[1].strip()))
|