summaryrefslogtreecommitdiff
path: root/check_whence.py
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2020-02-28 18:15:05 -0800
committerJosh Boyer <jwboyer@kernel.org>2020-03-02 08:06:45 -0500
commit94cb0a6837042dbdbd4e5a837c4447d91e1848fd (patch)
tree0160ec389d86aef9234b25cc02e56f176504837b /check_whence.py
parent7fa32bcc68a3c7a9496c49bdb10f1fdc68cf5ddb (diff)
downloadlinux-firmware-94cb0a6837042dbdbd4e5a837c4447d91e1848fd.tar.gz
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>
Diffstat (limited to 'check_whence.py')
-rwxr-xr-xcheck_whence.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/check_whence.py b/check_whence.py
index 04f41df..2d31f38 100755
--- a/check_whence.py
+++ b/check_whence.py
@@ -1,9 +1,10 @@
#!/usr/bin/python
import os, re, sys
+from io import open
def list_whence():
- with open('WHENCE') as whence:
+ with open('WHENCE', encoding='utf-8') as whence:
for line in whence:
match = re.match(r'(?:File|Source):\s*"(.*)"', line)
if match: