]> git.ipfire.org Git - thirdparty/linux-firmware.git/commitdiff
check_whence: python3/utf-8 support
authorBrian Norris <briannorris@chromium.org>
Sat, 29 Feb 2020 02:15:05 +0000 (18:15 -0800)
committerJosh Boyer <jwboyer@kernel.org>
Mon, 2 Mar 2020 13:06:45 +0000 (08:06 -0500)
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>
check_whence.py

index 04f41dfc5f9e5976b2031a435bbf5d2bd00056b6..2d31f38391063f4c95ecc15e72e8f68fb3faa8c0 100755 (executable)
@@ -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: