Convert existing py tools to python3

This commit is contained in:
Daniel Martí 2016-02-25 13:39:39 +00:00
parent d79fccb2da
commit 7e86dc5e48
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# List supported languages missing from the preference array
@ -32,8 +32,8 @@ for d in glob.glob(os.path.join('res', 'values-*')):
continue
trans.add(lang)
print "In the settings array: %s" % ' '.join(prefs)
print "Actually translated: %s" % ' '.join(trans)
print("In the settings array: %s" % ' '.join(prefs))
print("Actually translated: %s" % ' '.join(trans))
missing = []
for lang in trans:
@ -41,9 +41,9 @@ for lang in trans:
missing.append(lang)
if missing:
print "Missing:"
print("Missing:")
for lang in missing:
print " %s" % lang
print(" %s" % lang)
extra = []
for lang in prefs:
@ -51,11 +51,11 @@ for lang in prefs:
extra.append(lang)
if extra:
print "Extra:"
print("Extra:")
for lang in extra:
print " %s" % lang
print(" %s" % lang)
if not missing and not extra:
print "All good."
print("All good.")
else:
sys.exit(1)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# Remove extra translations
@ -31,7 +31,7 @@ for d in glob.glob(os.path.join('res', 'values-*')):
if not e.text:
root.remove(e)
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8'))
result = re.sub(r' />', r'/>', ElementTree.tostring(root, encoding='utf-8').decode('utf-8'))
with open(str_path, 'w+') as f:
f.write(header)