]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/PatchCheck.py: Fix error when run with Python3
authorDandan Bi <dandan.bi@intel.com>
Wed, 5 Sep 2018 06:58:07 +0000 (14:58 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 6 Sep 2018 05:41:35 +0000 (13:41 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1145

Currently run PatchCheck.py with Python3 will meet
following error:
.....
File "PatchCheck.py", line 554, in run_git
return Result[0].decode('utf-8', 'ignore') if Result[0] and
Result[0].find("fatal")!=0 else None
TypeError: a bytes-like object is required, not 'str'

This issue was introduce by commit:5ac4548cdf654.

This patch is to convert the str object of "fatal" to
byte object to fix this failure.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
BaseTools/Scripts/PatchCheck.py

index 96b3cdf1fd8a52d1e39b185c11196cb623b96648..0b580f3b3165d5fbaa300e9ea7fde0dfae0db910 100755 (executable)
@@ -551,7 +551,7 @@ class CheckGitCommits:
                      stdout=subprocess.PIPE,\r
                      stderr=subprocess.STDOUT)\r
         Result = p.communicate()\r
-        return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find("fatal")!=0 else None\r
+        return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find(b"fatal")!=0 else None\r
 \r
 class CheckOnePatchFile:\r
     """Performs a patch check for a single file.\r