diff --git a/setup.py b/setup.py index 2d562ce73e..d8072af50d 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ if __name__ == '__main__': build_osx, upload_installers, upload_user_manual, \ upload_to_pypi, stage3, stage2, stage1, upload, \ upload_rss, betas, build_linux32, build_linux64, \ - build_osx64 + build_osx64, get_translations resources.SCRIPTS = {} for x in ('console', 'gui'): for name in basenames[x]: @@ -265,6 +265,7 @@ if __name__ == '__main__': 'manual' : manual, 'resources' : resources, 'translations' : translations, + 'get_translations': get_translations, 'gui' : gui, 'clean' : clean, 'sdist' : sdist, diff --git a/upload.py b/upload.py index 9574c633b3..76d101013e 100644 --- a/upload.py +++ b/upload.py @@ -281,6 +281,32 @@ class translations(OptionlessCommand): if os.path.exists(path): os.remove(path) +class get_translations(translations): + + description = 'Get updated translations from Launchpad' + BRANCH = 'lp:~kovid/calibre/translations' + + def run(self): + cwd = os.getcwd() + subprocess.check_call(['bzr', 'merge', self.BRANCH]) + + def check_for_errors(self): + errors = os.path.join(self.PATH, '.errors') + if os.path.exists(errors): + shutil.rmtree(errors) + pofilter = ('pofilter', '-i', '.', '-o', errors, + '-t', 'accelerators', '-t', 'escapes', '-t', 'variables', + #'-t', 'xmltags', + '-t', 'printf') + subprocess.check_call(pofilter) + errs = os.listdir(errors) + if errs: + print 'WARNING: Translation errors detected' + print 'See http://translate.sourceforge.net/wiki/toolkit/using_pofilter' + print 'Error files:\n' + for e in errs: + print os.path.join(errors, e) + class gui(OptionlessCommand): description='''Compile all GUI forms and images'''