OSDN Git Service

review updatetranslations script
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 27 Jul 2019 17:09:34 +0000 (17:09 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 27 Jul 2019 17:09:34 +0000 (17:09 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
scripts/updatetranslations.py

index 7c3f67c..9182773 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import os, glob, subprocess, shlex
+import os, glob, subprocess
 
 components = ('core', 'dbus', 'declarative', 'gui', 'network', 'plugins',
     'script', 'scripttools', 'sql', 'svg', 'test', 'uitools', 'xml')
@@ -22,13 +22,10 @@ for t in glob.glob('src/tools/*'):
     tfiles.extend(list_files(t))
 
 for t in glob.glob('translations/qt*.ts'):
-    if 'tools' in t:
-        files = ' '.join(tfiles)
+    command = ['minsize/bin/lupdate', '-locations', 'relative', '-no-ui-lines', '-no-obsolete']
+    if not 'tools' in t:
+        command.extend(tfiles)
     else:
-        files = ' '.join(cfiles)
-    command = 'minsize/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()))
+        command.extend(cfiles)
+    command.extend(['-ts', t])
+    subprocess.check_call(command)