scripts: add Python 3 compatibility to spdxcheck.py
authorJeremy Cline <jcline@redhat.com>
Fri, 17 Aug 2018 22:44:01 +0000 (15:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Aug 2018 23:20:27 +0000 (16:20 -0700)
commitbed95c43c15eb6b1ccc5b09e5ae08cac726c456d
tree7e65fdd4f065437bbe1b534efb89fae47dc87ceb
parentfde5e903fb5893415fa49d280e998be226d0898f
scripts: add Python 3 compatibility to spdxcheck.py

"dict.has_key(key)" on dictionaries has been replaced with "key in
dict".  Additionally, when run under Python 3 some files don't decode
with the default encoding (tested with UTF-8).  To handle that, don't
open the file in text mode and decode text line-by-line, ignoring
encoding errors.

This remains compatible with Python 2 and should have no functional
change.

Link: http://lkml.kernel.org/r/20180717190635.29467-1-jcline@redhat.com
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/spdxcheck.py