Kaydet (Commit) 8276d87f authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #20079: makelocalealias.py now supports installed SUPPORTED file,

not only source SUPPORTED file in glibc sources tree.
üst 5189ee54
...@@ -10,8 +10,10 @@ import locale ...@@ -10,8 +10,10 @@ import locale
import sys import sys
_locale = locale _locale = locale
# Location of the alias file # Location of the X11 alias file.
LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias' LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias'
# Location of the glibc SUPPORTED locales file.
SUPPORTED = '/usr/share/i18n/SUPPORTED'
def parse(filename): def parse(filename):
...@@ -59,10 +61,12 @@ def parse_glibc_supported(filename): ...@@ -59,10 +61,12 @@ def parse_glibc_supported(filename):
continue continue
if line[:1] == '#': if line[:1] == '#':
continue continue
if '/' not in line: line = line.replace('/', ' ').strip()
continue
line = line.rstrip('\\').rstrip() line = line.rstrip('\\').rstrip()
alias, _, alias_encoding = line.partition('/') words = line.split()
if len(words) != 2:
continue
alias, alias_encoding = words
# Lower-case locale # Lower-case locale
locale = alias.lower() locale = alias.lower()
# Normalize encoding, if given # Normalize encoding, if given
...@@ -125,13 +129,13 @@ if __name__ == '__main__': ...@@ -125,13 +129,13 @@ if __name__ == '__main__':
parser.add_argument('--locale-alias', default=LOCALE_ALIAS, parser.add_argument('--locale-alias', default=LOCALE_ALIAS,
help='location of the X11 alias file ' help='location of the X11 alias file '
'(default: %a)' % LOCALE_ALIAS) '(default: %a)' % LOCALE_ALIAS)
parser.add_argument('--glibc-supported', parser.add_argument('--glibc-supported', default=SUPPORTED,
help='location of the glibc SUPPORTED locales file') help='location of the glibc SUPPORTED locales file '
'(default: %a)' % SUPPORTED)
args = parser.parse_args() args = parser.parse_args()
data = locale.locale_alias.copy() data = locale.locale_alias.copy()
if args.glibc_supported: data.update(parse_glibc_supported(args.glibc_supported))
data.update(parse_glibc_supported(args.glibc_supported))
data.update(parse(args.locale_alias)) data.update(parse(args.locale_alias))
while True: while True:
# Repeat optimization while the size is decreased. # Repeat optimization while the size is decreased.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment