summaryrefslogtreecommitdiffstats
path: root/Tools/i18n/makelocalealias.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-23 16:56:08 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-23 16:56:08 (GMT)
commit55c6cc408c56f586c4826c1d9639a5f4635c021c (patch)
treec8d5c8abaef7b70812fc07c161087894463f8676 /Tools/i18n/makelocalealias.py
parenta4d170d985df52d3fedf908c158824c057c9b7c6 (diff)
downloadcpython-55c6cc408c56f586c4826c1d9639a5f4635c021c.zip
cpython-55c6cc408c56f586c4826c1d9639a5f4635c021c.tar.gz
cpython-55c6cc408c56f586c4826c1d9639a5f4635c021c.tar.bz2
Issue #20033: makelocalealias.py now works with non-ASCII locales and produces
the same result as in 2.x.
Diffstat (limited to 'Tools/i18n/makelocalealias.py')
-rw-r--r--Tools/i18n/makelocalealias.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Tools/i18n/makelocalealias.py b/Tools/i18n/makelocalealias.py
index 68544ac..3445ec8 100644
--- a/Tools/i18n/makelocalealias.py
+++ b/Tools/i18n/makelocalealias.py
@@ -13,8 +13,8 @@ LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias'
def parse(filename):
- f = open(filename)
- lines = f.read().splitlines()
+ with open(filename, encoding='latin1') as f:
+ lines = list(f)
data = {}
for line in lines:
line = line.strip()
@@ -47,15 +47,15 @@ def parse(filename):
def pprint(data):
items = sorted(data.items())
for k, v in items:
- print(' %-40s%r,' % ('%r:' % k, v))
+ print(' %-40s%a,' % ('%a:' % k, v))
def print_differences(data, olddata):
items = sorted(olddata.items())
for k, v in items:
if k not in data:
- print('# removed %r' % k)
+ print('# removed %a' % k)
elif olddata[k] != data[k]:
- print('# updated %r -> %r to %r' % \
+ print('# updated %a -> %a to %a' % \
(k, olddata[k], data[k]))
# Additions are not mentioned