Fix compatibility of check_trans.py with Python 3.

This commit is contained in:
Valentin Lorentz 2014-01-23 10:22:32 +01:00
parent 8aa7e781a4
commit 7636039ada

View File

@ -43,9 +43,9 @@ def _checkCore(corePath):
potPath = os.path.join(os.getcwd(), 'locales', translation) potPath = os.path.join(os.getcwd(), 'locales', translation)
po = open(potPath) po = open(potPath)
if checkTranslation(pot, po): if checkTranslation(pot, po):
print 'OK: ' + potPath print('OK: ' + potPath)
else: else:
print 'ERROR: ' + potPath print('ERROR: ' + potPath)
@changedir @changedir
@ -60,15 +60,15 @@ def checkPlugin(pluginPath):
potPath = os.path.join(os.getcwd(), 'locales', translation) potPath = os.path.join(os.getcwd(), 'locales', translation)
po = open(potPath) po = open(potPath)
if checkTranslation(pot, po): if checkTranslation(pot, po):
print 'OK: ' + potPath print('OK: ' + potPath)
else: else:
print 'ERROR: ' + potPath print('ERROR: ' + potPath)
def checkTranslation(pot, po): def checkTranslation(pot, po):
checking = False checking = False
pot = set(map(operator.itemgetter(0), parse(pot))) pot = set(map(operator.itemgetter(0), parse(pot)))
po = set(map(operator.itemgetter(0), parse(po))) po = set(map(operator.itemgetter(0), parse(po)))
diff = filter(lambda x:x not in po, pot) diff = [x for x in pot if x not in po]
return not bool(diff) return not bool(diff)
if __name__ == '__main__': if __name__ == '__main__':