mirror of https://github.com/python/cpython
Issue #20033: makelocalealias.py now works with non-ASCII locales and produces
the same result as in 2.x.
This commit is contained in:
commit
a3409489b7
|
@ -13,8 +13,8 @@ LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias'
|
||||||
|
|
||||||
def parse(filename):
|
def parse(filename):
|
||||||
|
|
||||||
f = open(filename)
|
with open(filename, encoding='latin1') as f:
|
||||||
lines = f.read().splitlines()
|
lines = list(f)
|
||||||
data = {}
|
data = {}
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
@ -47,15 +47,15 @@ def parse(filename):
|
||||||
def pprint(data):
|
def pprint(data):
|
||||||
items = sorted(data.items())
|
items = sorted(data.items())
|
||||||
for k, v in items:
|
for k, v in items:
|
||||||
print(' %-40s%r,' % ('%r:' % k, v))
|
print(' %-40s%a,' % ('%a:' % k, v))
|
||||||
|
|
||||||
def print_differences(data, olddata):
|
def print_differences(data, olddata):
|
||||||
items = sorted(olddata.items())
|
items = sorted(olddata.items())
|
||||||
for k, v in items:
|
for k, v in items:
|
||||||
if k not in data:
|
if k not in data:
|
||||||
print('# removed %r' % k)
|
print('# removed %a' % k)
|
||||||
elif olddata[k] != data[k]:
|
elif olddata[k] != data[k]:
|
||||||
print('# updated %r -> %r to %r' % \
|
print('# updated %a -> %a to %a' % \
|
||||||
(k, olddata[k], data[k]))
|
(k, olddata[k], data[k]))
|
||||||
# Additions are not mentioned
|
# Additions are not mentioned
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue