1 Star 0 Fork 40

lb818/glibc-2.36

forked from Meredith/glibc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
parse-SUPPORTED.py 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
Meredith 提交于 2022-08-10 17:43 . init
#!/usr/bin/python3
#
# This script turns localedata/SUPPORTED (whose path is passed as the
# first argument) into a normalized list of LANGUAGE "_" REGION pairs.
# (If there is no REGION defined, only LANGUAGE is used.) The list
# is written to standard output, with one element per line.
import sys
supported, = sys.argv[1:]
# Pairs seen so far. Used to suppress duplicates.
seen = set()
with open(supported) as inp:
for line in inp:
if line.startswith("#") or line == "SUPPORTED-LOCALES=\\\n":
# Comment or prefix.
continue
if not line.endswith(" \\\n"):
raise IOError("line without continuation: " + repr(line))
try:
slash = line.index("/")
except ValueError:
raise IOError("line without slash: " + repr(line))
spec = line[:slash]
for separator in ".@":
try:
# Strip charset, variant specifiers.
spec = spec[:spec.index(separator)]
except ValueError:
pass
seen.add(spec)
# The C locale does not correspond to a language.
seen.remove("C")
# The glibc source file is not sorted.
for spec in sorted(seen):
print(spec)
print() # The Lua generator produces a trailing newline.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/binqray/glibc-2.36.git
git@gitee.com:binqray/glibc-2.36.git
binqray
glibc-2.36
glibc-2.36
a23-test

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385