From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 A673C21BADAB2 for ; Thu, 2 Aug 2018 16:59:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 16:59:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="251291162" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 02 Aug 2018 16:59:08 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 2 Aug 2018 16:59:08 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 2 Aug 2018 16:59:08 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by shsmsx102.ccr.corp.intel.com ([169.254.2.124]) with mapi id 14.03.0319.002; Fri, 3 Aug 2018 07:59:06 +0800 From: "Zhu, Yonghong" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Sun, Yanyan" , "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray() Thread-Index: AQHUKqdlj0inmujEfUSkAnYx8FyFKaStJC6g Date: Thu, 2 Aug 2018 23:59:05 +0000 Message-ID: References: <20180802212536.19980-1-michael.d.kinney@intel.com> In-Reply-To: <20180802212536.19980-1-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWRiYzg1NTctNmRiZC00ZjAzLTg1OTMtOWUxMzc2YWQwYTIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVFl5U2lITSsxOUJEUVdMMnFwWHZxcUlrZEJYaGV5RFwvZ3ZEQ1d0SU15UmoyQTltRHBpemFWUDBOeVJQRFE2XC8zIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2018 23:59:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Kinney, Michael D=20 Sent: Friday, August 3, 2018 5:26 AM To: edk2-devel@lists.01.org Cc: Sun, Yanyan ; Zhu, Yonghong ; Gao, Liming ; Kinney, Michael D Subject: [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray(= ) https://bugzilla.tianocore.org/show_bug.cgi?id=3D1069 The ByteArray() method returns a string with the hex bytes of a PCD value. = Make sure the string is always encoded as a string, so it can be used to b= uild a complete PCD statement string and be written out to a file. This ch= ange is required for Python 3.x compatibility. Cc: YanYan Sun Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- BaseTools/Scripts/BinToPcd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py = index 25b74f6004..1495a36933 100644 --- a/BaseTools/Scripts/BinToPcd.py +++ b/BaseTools/Scripts/BinToPcd.py @@ -70,7 +70,8 @@ if __name__ =3D=3D '__main__': # # Return a PCD value of the form '{0x01, 0x02, ...}' along with th= e PCD length in bytes # - return '{' + (', '.join (['0x{Byte:02X}'.format (Byte =3D Item) fo= r Item in Buffer])) + '}', len (Buffer) + PcdValue =3D '{' + ', '.join (['0x{Byte:02X}'.format (Byte =3D Ite= m) for Item in Buffer]) + '}' + return PcdValue.encode (), len (Buffer) =20 # # Create command line argument parser object -- 2.14.2.windows.3