-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.py
40 lines (29 loc) · 940 Bytes
/
release.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import PySide
import os
from os import path
import subprocess
ps_dir = path.dirname(PySide.__file__)
def get_pstool(name):
try:
pth = subprocess.check_output(["which", name])
if pth: return pth.strip()
except: pass
pth = path.join(ps_dir, name)
if os.name == "nt":
pth += ".exe"
return pth
ps_lupdate = get_pstool("pyside-lupdate")
ps_lconvert = get_pstool("lconvert")
ps_lrelease = get_pstool("lrelease")
langdir = path.dirname(__file__)
i18n = path.join(langdir, "i18n")
build = path.join(langdir, "build")
files = os.listdir(i18n)
langs = [ts[:-3] for ts in files if ts.endswith(".ts")]
if not path.exists(build):
os.mkdir(build)
for lang in langs:
subprocess.check_call([ps_lrelease, i18n + "/%s.ts" % lang, "-qm",
build + "/%s.qm" % lang])
subprocess.check_call([ps_lrelease, langdir + "/en.ts", "-qm",
build + "/en.qm"])