mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix build problems on windows
This commit is contained in:
parent
f53fc46c42
commit
b39538fbc8
@ -46,9 +46,9 @@ def main(args=sys.argv):
|
|||||||
print 'Creating translations template'
|
print 'Creating translations template'
|
||||||
pygettext(buf, ['-p', tdir]+files)
|
pygettext(buf, ['-p', tdir]+files)
|
||||||
src = buf.getvalue()
|
src = buf.getvalue()
|
||||||
template = tempfile.NamedTemporaryFile(suffix='.pot')
|
fd, fname = tempfile.mkstemp(suffix='.pot')
|
||||||
template.write(src)
|
os.write(fd,src)
|
||||||
template.flush()
|
|
||||||
translations = {}
|
translations = {}
|
||||||
for tr in TRANSLATIONS:
|
for tr in TRANSLATIONS:
|
||||||
po = os.path.join(tdir, tr+'.po')
|
po = os.path.join(tdir, tr+'.po')
|
||||||
@ -56,12 +56,14 @@ def main(args=sys.argv):
|
|||||||
open(po, 'wb').write(src.replace('LANGUAGE', tr))
|
open(po, 'wb').write(src.replace('LANGUAGE', tr))
|
||||||
else:
|
else:
|
||||||
print 'Merging', os.path.basename(po)
|
print 'Merging', os.path.basename(po)
|
||||||
check_call('msgmerge -v -U -N --backup=none '+po + ' ' + template.name)
|
check_call('msgmerge -v -U -N --backup=none '+po + ' ' + fname)
|
||||||
buf = cStringIO.StringIO()
|
buf = cStringIO.StringIO()
|
||||||
print 'Compiling translations'
|
print 'Compiling translations'
|
||||||
msgfmt(buf, [po])
|
msgfmt(buf, [po])
|
||||||
translations[tr] = buf.getvalue()
|
translations[tr] = buf.getvalue()
|
||||||
open(os.path.join(tdir, 'data.py'), 'wb').write('translations = '+repr(translations))
|
open(os.path.join(tdir, 'data.py'), 'wb').write('translations = '+repr(translations))
|
||||||
|
os.close(fd)
|
||||||
|
os.unlink(fname)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user