From 7131eec356e84f4d8ec0205093a7a1ac091e6019 Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 1 Jan 2019 11:33:52 -0600 Subject: [PATCH] Fix update_po.py to run on Windows --- po/update_po.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/po/update_po.py b/po/update_po.py index 5e7547225..a013f5418 100644 --- a/po/update_po.py +++ b/po/update_po.py @@ -51,11 +51,18 @@ from __future__ import print_function import os import sys +import shutil from argparse import ArgumentParser # Windows OS -if sys.platform == 'win32': +if sys.platform in ['linux', 'linux2', 'darwin', 'cygwin'] or shutil.which('msgmerge'): + msgmergeCmd = 'msgmerge' + msgfmtCmd = 'msgfmt' + msgattribCmd = 'msgattrib' + xgettextCmd = 'xgettext' + pythonCmd = os.path.join(sys.prefix, 'bin', 'python3') +elif sys.platform == 'win32': # GetText Win 32 obtained from http://gnuwin32.sourceforge.net/packages/gettext.htm # ....\gettext\bin\msgmerge.exe needs to be on the path msgmergeCmd = os.path.join('C:', 'Program Files(x86)', 'gettext', 'bin', 'msgmerge.exe') @@ -163,7 +170,7 @@ def TipsParse(filename, mark): "Editor." ''' - with open('../data/tips.xml.in.h', 'w') as tips: + with open('../data/tips.xml.in.h', 'w', encoding='utf-8') as tips: marklist = root.iter(mark) for key in marklist: tip = ElementTree.tostring(key, encoding="UTF-8", method="xml")