make script py2/3 compatible

pull/3376/merge
Daniel Chimeno 2017-03-07 12:50:14 +01:00 zatwierdzone przez Matt Westcott
rodzic 21f1292cf7
commit 92f64bef27
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
from __future__ import print_function
import subprocess import subprocess
import re import re
from collections import defaultdict from collections import defaultdict
from io import open
from babel import Locale from babel import Locale
@ -12,12 +14,12 @@ for file_listing_line in file_listing.stdout:
filename = file_listing_line.strip() filename = file_listing_line.strip()
# extract locale string from filename # extract locale string from filename
locale = re.search(r'locale/(\w+)/LC_MESSAGES', filename).group(1) locale = re.search(r'locale/(\w+)/LC_MESSAGES', str(filename)).group(1)
if locale == 'en': if locale == 'en':
continue continue
# read author list from each file # read author list from each file
with file(filename) as f: with open(filename, 'rt') as f:
has_found_translators_heading = False has_found_translators_heading = False
for line in f: for line in f:
line = line.strip() line = line.strip()
@ -40,7 +42,7 @@ language_names = [
language_names.sort() language_names.sort()
for (language_name, locale) in language_names: for (language_name, locale) in language_names:
print(("%s - %s" % (language_name, locale)).encode('utf-8')) print(("%s - %s" % (language_name, locale)))
print("-----") print("-----")
for author in sorted(authors_by_locale[locale]): for author in sorted(authors_by_locale[locale]):
print(author) print(author)