From: Brian Norris Date: Sat, 29 Feb 2020 02:15:05 +0000 (-0800) Subject: check_whence: python3/utf-8 support X-Git-Tag: 20200316~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=94cb0a6837042dbdbd4e5a837c4447d91e1848fd;p=thirdparty%2Flinux-firmware.git 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 Signed-off-by: Josh Boyer --- diff --git a/check_whence.py b/check_whence.py index 04f41dfc..2d31f383 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: