From nobody Wed May 1 23:20:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66563+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66563+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1603446903; cv=none; d=zohomail.com; s=zohoarc; b=gpc+IND/dSHFTZF0sLspRwAEY24Zeh9fCq3GQSsQ3ZRQIbq75qXRZPjTv2kKPe7kNIHGlFmd04+P8v7OlZZ0SCzWPownewAr4FKuDuqOi/Hz4lzHNR8bP0xaLO1bB5CgNrGqpPEaQtiaFYV/80cOfd1MdqhPJvSbO5tfKrDjO4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603446903; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=xhjQGbXDJQRArmZYbO/z5zRvWg5KgAV5D6psTjBn25c=; b=OHPd7OVXfqu0CUDlXjhWRouSKDW5OEOE30gG4nTS5ueGSticm4YjV6JdACS4eoaOMAIfNA2w90aVpJnI2DltkMnM/HaSQhaIK17XE750YHavTucCvO9CaoeY4q8YvzodzQDqbkYgxLkYofM238sROirNMxV4a22QUQ0mr6zcrIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66563+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1603446903376793.499880805296; Fri, 23 Oct 2020 02:55:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DeX8YY1788612xx61AJf2cIS; Fri, 23 Oct 2020 02:55:03 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.3465.1603422105084138876 for ; Thu, 22 Oct 2020 20:01:45 -0700 IronPort-SDR: kuW9NrDKc9ESlRmaMshxekIiTJC/NIH5OTQZd9Cwmmr+1lfbuofKxnmovZ5qA9rJO7PRD/MwgI mHH4HpPLf8uA== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="252320558" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="252320558" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 20:01:44 -0700 IronPort-SDR: kuKn9Oz2GKs0mtaLKb6Ofj7Y+8qT8vzEb8bY/ffwGsKQ9TRcw9IBgkPbelKzf/HtlTASXXwvnn NBOLctV6QCZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="354304519" X-Received: from bob-desktop.ccr.corp.intel.com ([10.239.49.38]) by fmsmga002.fm.intel.com with ESMTP; 22 Oct 2020 20:01:43 -0700 From: mliang2x To: devel@edk2.groups.io Cc: Mingyue Liang , Bob Feng , Liming Gao , Yuwei Chen Subject: [edk2-devel] [PATCH] BaseTools: replace array.fromstring Method for supports py-2 and py-3. Date: Fri, 23 Oct 2020 11:01:42 +0800 Message-Id: <20201023030142.2015-1-mingyuex.liang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mingyuex.liang@intel.com X-Gm-Message-State: efX0cyCCPSlOUdeqe6PO2wXqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1603446903; bh=YaNvH18QrCLCRqQrE0AF1SMSv0GNDnJ9uZFtaoBMVqQ=; h=Cc:Date:From:Reply-To:Subject:To; b=g1VtFhuQlrq1DH7zrw+LyIRJlmzqdflPUZqDbNv/lqxQQO6dbpQsY8HIZiNY6D8+AIy sP/9gJ0Yy6s7ZDBP9wO3Y7C5NGa6wSCAZmTAQRImSbUZMV/ytdaNflHpgw7txK41y9RWZ mnC9c6FmflN/HvwZDAuB+3QM50GE6P1AiP8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Because after Python 3.2, array.fromstring method is renamed frombytes, so it needs to be modified to support python2 and python3 methods. Signed-off-by: Mingyue Liang Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- BaseTools/Source/Python/Eot/EotMain.py | 8 ++++---- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Pyth= on/Eot/EotMain.py index 791fcdfeae..2ff68054e6 100644 --- a/BaseTools/Source/Python/Eot/EotMain.py +++ b/BaseTools/Source/Python/Eot/EotMain.py @@ -152,11 +152,11 @@ class CompressedImage(Image): try: TmpData =3D DeCompress('Efi', self[self._HEADER_SIZE_:]) DecData =3D array('B') - DecData.fromstring(TmpData) + list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData)) except: TmpData =3D DeCompress('Framework', self[self._HEADER_SIZE_:]) DecData =3D array('B') - DecData.fromstring(TmpData) + list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpData)) =20 SectionList =3D [] Offset =3D 0 @@ -738,7 +738,7 @@ class GuidDefinedImage(Image): Offset =3D self.DataOffset - 4 TmpData =3D DeCompress('Framework', self[self.Offset:]) DecData =3D array('B') - DecData.fromstring(TmpData) + list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpD= ata)) Offset =3D 0 while Offset < len(DecData): Sec =3D Section() @@ -759,7 +759,7 @@ class GuidDefinedImage(Image): =20 TmpData =3D DeCompress('Lzma', self[self.Offset:]) DecData =3D array('B') - DecData.fromstring(TmpData) + list(map(lambda str: DecData.fromlist([ord(str), 0]), TmpD= ata)) Offset =3D 0 while Offset < len(DecData): Sec =3D Section() diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index dc1727c466..411af80c2b 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -463,7 +463,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).s= trip()) else: SectionData =3D array('B', [0, 0, 0, 0]) - SectionData.fromstring(Ui.encode("utf_16_le")) + list(map(lambda str: SectionData.fromlist([ord(str), 0]), = Ui)) SectionData.append(0) SectionData.append(0) Len =3D len(SectionData) --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66563): https://edk2.groups.io/g/devel/message/66563 Mute This Topic: https://groups.io/mt/77748883/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-