Make check-includes.py properly report bad UTF-8 on all platforms rather than crashing on Python 3.
Doesn't really belong there, but just removing the check doesn't feel like a good idea.
This commit is contained in:
parent
be44fdf0ec
commit
5e25b6389c
|
@ -76,7 +76,16 @@ def show_differences(bad, good):
|
||||||
|
|
||||||
def check_file(path):
|
def check_file(path):
|
||||||
print('Checking %s' % path)
|
print('Checking %s' % path)
|
||||||
lines = (l.strip() for l in open(path).read().split('\n'))
|
try:
|
||||||
|
try:
|
||||||
|
data = open(path, encoding='utf-8').read()
|
||||||
|
except TypeError: # py2
|
||||||
|
data = open(path).read().decode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
sys.stderr.write('%s: bad UTF-8 data\n' % path)
|
||||||
|
return
|
||||||
|
|
||||||
|
lines = (l.strip() for l in data.split('\n'))
|
||||||
lines = exclude_if_blocks(lines)
|
lines = exclude_if_blocks(lines)
|
||||||
includes = list(filter_includes(lines))
|
includes = list(filter_includes(lines))
|
||||||
sorted_includes = sort_includes(includes)
|
sorted_includes = sort_includes(includes)
|
||||||
|
|
Loading…
Reference in New Issue