]> git.proxmox.com Git - mirror_ovs.git/commit - utilities/checkpatch.py
checkpatch: Use default encoding from email library.
authorJoe Stringer <joe@ovn.org>
Tue, 4 Jul 2017 14:16:46 +0000 (07:16 -0700)
committerJoe Stringer <joe@ovn.org>
Thu, 6 Jul 2017 12:45:34 +0000 (05:45 -0700)
commit822a3d8831563bea9e8a9b32a43721cd3221054d
treecb85583189efdaddd02e203497ab13d26b2e0760
parent665c4688adda8e26d956f0c1caa4ef459a579ed7
checkpatch: Use default encoding from email library.

There are three paths for running the core checkpatch path: From a file,
from stdin, or reading from git output. Currently, the file version of
this calls the "email" library's decode routine which translates the
stream into a bytes array, which we later call decode() to turn it back
into a regular string. This works on python2 and python3, but the other
paths don't work in python3 due to the following error:

$ utilities/checkpatch.py -1
== Checking HEAD~0 ==
Traceback (most recent call last):
  File "utilities/checkpatch.py", line 491, in <module>
    if ovs_checkpatch_parse(patch, revision):
  File "utilities/checkpatch.py", line 324, in ovs_checkpatch_parse
    for line in text.decode().split('\n'):
AttributeError: 'str' object has no attribute 'decode'

Rather than performing this extra encode/decode, strip these out from
this path so that the stdin and git variants of checkpatch can work in
python3.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
utilities/checkpatch.py