Let mk_hyb_file.py replace SS in .chr.txt files with . am: fcb08dbdee

am: 676a881f8f

Change-Id: Ibdd3ccabf5dd4d8f5d0fe0f119027835bfd72443
This commit is contained in:
Fredrik Roubert
2017-04-27 14:52:58 +00:00
committed by android-build-merger

View File

@@ -35,6 +35,10 @@ import getopt
VERBOSE = False VERBOSE = False
# U+00DF is LATIN SMALL LETTER SHARP S
# U+1E9E is LATIN CAPITAL LETTER SHARP S
SHARP_S_TO_DOUBLE = u'\u00dfSS'
SHARP_S_TO_CAPITAL = u'\u00df\u1e9e'
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
def unichr(x): def unichr(x):
@@ -283,8 +287,12 @@ def load_chr(fn):
for i, l in enumerate(f): for i, l in enumerate(f):
l = l.strip() l = l.strip()
if len(l) > 2: if len(l) > 2:
# lowercase maps to multi-character uppercase sequence, ignore uppercase for now if l == SHARP_S_TO_DOUBLE:
l = l[:1] # replace with lowercasing from capital letter sharp s
l = SHARP_S_TO_CAPITAL
else:
# lowercase maps to multi-character uppercase sequence, ignore uppercase for now
l = l[:1]
else: else:
assert len(l) == 2, 'expected 2 chars in chr' assert len(l) == 2, 'expected 2 chars in chr'
for c in l: for c in l:
@@ -419,6 +427,9 @@ def verify_file_sorted(lines, fn):
file_lines = [l.strip() for l in io.open(fn, encoding='UTF-8')] file_lines = [l.strip() for l in io.open(fn, encoding='UTF-8')]
line_set = set(lines) line_set = set(lines)
file_set = set(file_lines) file_set = set(file_lines)
if SHARP_S_TO_DOUBLE in file_set:
# ignore difference of double capital letter s and capital letter sharp s
file_set.symmetric_difference_update([SHARP_S_TO_DOUBLE, SHARP_S_TO_CAPITAL])
if line_set == file_set: if line_set == file_set:
return True return True
for line in line_set - file_set: for line in line_set - file_set: