From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 41E632111B762 for ; Wed, 5 Sep 2018 08:02:13 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 08:02:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,333,1531810800"; d="scan'208";a="87431228" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 05 Sep 2018 08:02:01 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 08:02:00 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.126]) by FMSMSX155.amr.corp.intel.com ([169.254.5.90]) with mapi id 14.03.0319.002; Wed, 5 Sep 2018 08:02:00 -0700 From: "Carsey, Jaben" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [patch] BaseTools/PatchCheck.py: Fix error when run with Python3 Thread-Index: AQHUROk99Ol1mCtCjUypj4Ahd3l586ThyL4g Date: Wed, 5 Sep 2018 15:02:00 +0000 Message-ID: References: <20180905072113.73680-1-dandan.bi@intel.com> In-Reply-To: <20180905072113.73680-1-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmIwNzU3ZGYtODc4NC00ZDdkLTg5OGYtN2NhN2Q2NWIyOTY1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiN2U5bGVUUmlhOStjYkY4TksrVDZ2WWtrWDJ3VUhjOWRiNktnS2dJMlVmaDNMTlwvWHBNSEZsOEJRdHFFTHl5K04ifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [patch] BaseTools/PatchCheck.py: Fix error when run with Python3 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 15:02:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Bi, Dandan > Sent: Wednesday, September 05, 2018 12:21 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Carsey, Jaben > ; Zhu, Yonghong > Subject: [patch] BaseTools/PatchCheck.py: Fix error when run with Python3 > Importance: High >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1145 >=20 > 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")!=3D0 else None > TypeError: a bytes-like object is required, not 'str' >=20 > This issue was introduce by commit:5ac4548cdf654. >=20 > This patch is to convert the str object of "fatal" to > byte object to fix this failure. >=20 > Cc: Liming Gao > Cc: Jaben Carsey > Cc: Yonghong Zhu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Dandan Bi > --- > BaseTools/Scripts/PatchCheck.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/BaseTools/Scripts/PatchCheck.py > b/BaseTools/Scripts/PatchCheck.py > index 96b3cdf1fd..0b580f3b31 100755 > --- a/BaseTools/Scripts/PatchCheck.py > +++ b/BaseTools/Scripts/PatchCheck.py > @@ -549,11 +549,11 @@ class CheckGitCommits: > cmd +=3D args > p =3D subprocess.Popen(cmd, > stdout=3Dsubprocess.PIPE, > stderr=3Dsubprocess.STDOUT) > Result =3D p.communicate() > - return Result[0].decode('utf-8', 'ignore') if Result[0] and > Result[0].find("fatal")!=3D0 else None > + return Result[0].decode('utf-8', 'ignore') if Result[0] and > Result[0].find(b"fatal")!=3D0 else None >=20 > class CheckOnePatchFile: > """Performs a patch check for a single file. >=20 > stdin is used when the filename is '-'. > -- > 2.14.3.windows.1