check_whence: python3/utf-8 support
WHENCE contains non-ASCII characters, so we should specify an encoding. To get the encoding= arg in python2, we pull open from 'io' directly. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Josh Boyer <jwboyer@kernel.org>
This commit is contained in:
parent
7fa32bcc68
commit
94cb0a6837
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import os, re, sys
|
import os, re, sys
|
||||||
|
from io import open
|
||||||
|
|
||||||
def list_whence():
|
def list_whence():
|
||||||
with open('WHENCE') as whence:
|
with open('WHENCE', encoding='utf-8') as whence:
|
||||||
for line in whence:
|
for line in whence:
|
||||||
match = re.match(r'(?:File|Source):\s*"(.*)"', line)
|
match = re.match(r'(?:File|Source):\s*"(.*)"', line)
|
||||||
if match:
|
if match:
|
||||||
|
|
Loading…
Reference in New Issue