Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8276d87

Browse files
Issue #20079: makelocalealias.py now supports installed SUPPORTED file,
not only source SUPPORTED file in glibc sources tree.
1 parent 5189ee5 commit 8276d87

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

Tools/i18n/makelocalealias.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
import sys
1111
_locale = locale
1212

13-
# Location of the alias file
13+
# Location of the X11 alias file.
1414
LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias'
15+
# Location of the glibc SUPPORTED locales file.
16+
SUPPORTED = '/usr/share/i18n/SUPPORTED'
1517

1618
def parse(filename):
1719

@@ -59,10 +61,12 @@ def parse_glibc_supported(filename):
5961
continue
6062
if line[:1] == '#':
6163
continue
62-
if '/' not in line:
63-
continue
64+
line = line.replace('/', ' ').strip()
6465
line = line.rstrip('\\').rstrip()
65-
alias, _, alias_encoding = line.partition('/')
66+
words = line.split()
67+
if len(words) != 2:
68+
continue
69+
alias, alias_encoding = words
6670
# Lower-case locale
6771
locale = alias.lower()
6872
# Normalize encoding, if given
@@ -125,13 +129,13 @@ def check(data):
125129
parser.add_argument('--locale-alias', default=LOCALE_ALIAS,
126130
help='location of the X11 alias file '
127131
'(default: %a)' % LOCALE_ALIAS)
128-
parser.add_argument('--glibc-supported',
129-
help='location of the glibc SUPPORTED locales file')
132+
parser.add_argument('--glibc-supported', default=SUPPORTED,
133+
help='location of the glibc SUPPORTED locales file '
134+
'(default: %a)' % SUPPORTED)
130135
args = parser.parse_args()
131136

132137
data = locale.locale_alias.copy()
133-
if args.glibc_supported:
134-
data.update(parse_glibc_supported(args.glibc_supported))
138+
data.update(parse_glibc_supported(args.glibc_supported))
135139
data.update(parse(args.locale_alias))
136140
while True:
137141
# Repeat optimization while the size is decreased.

0 commit comments

Comments
 (0)