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=yonghong.zhu@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 97A74226612A8 for ; Wed, 25 Apr 2018 01:50:58 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2018 01:50:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,325,1520924400"; d="scan'208";a="53481051" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 25 Apr 2018 01:50:57 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Apr 2018 01:50:48 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Apr 2018 01:50:47 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.40]) with mapi id 14.03.0319.002; Wed, 25 Apr 2018 16:50:45 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo Thread-Index: AQHT2L+HzNjIuP1NEkCxO4Sn5zVxvaQRM3wQ Date: Wed, 25 Apr 2018 08:50:45 +0000 Message-ID: References: <33a59704e3586a42b9ab964b3f54a197b0ed36ea.1524239027.git.jaben.carsey@intel.com> In-Reply-To: <33a59704e3586a42b9ab964b3f54a197b0ed36ea.1524239027.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 08:50:58 -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: Carsey, Jaben=20 Sent: Friday, April 20, 2018 11:51 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdIn= fo the function doesn't use self and can be static defaultdict replaces dict a= nd removes the dict initialization code Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Workspace/DscBuildData.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index be3f7b6881e8..904c52d9576a 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -39,7 +39,7 @@ import Common.GlobalData as GlobalData import subprocess= from Common.Misc import SaveFileOnChange from Workspace.BuildClassObject= import PlatformBuildClassObject, StructurePcd, PcdClassObject, ModuleBuild= ClassObject -from collections import OrderedDict +from collections import OrderedDict,defaultdict =20 variablePattern =3D re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$') =20 @@ -1187,11 +1187,10 @@ class DscBuildData(PlatformBuildClassObject): options[Key] +=3D ' ' + Option return self._ModuleTypeOptions[Edk, ModuleType] =20 - def GetStructurePcdInfo(self, PcdSet): - structure_pcd_data =3D {} + @staticmethod + def GetStructurePcdInfo(PcdSet): + structure_pcd_data =3D defaultdict(list) for item in PcdSet: - if (item[0],item[1]) not in structure_pcd_data: - structure_pcd_data[(item[0],item[1])] =3D [] structure_pcd_data[(item[0],item[1])].append(item) =20 return structure_pcd_data @@ -1298,7 +1297,7 @@ class DscBuildData(PlatformBuildClassObject): S_PcdSet.append([ TokenSpaceGuid.split(".")[0],TokenSpaceG= uid.split(".")[1], PcdCName,SkuName, default_store,Dummy5, AnalyzePcdExpres= sion(Setting)[0]]) =20 # handle pcd value override - StrPcdSet =3D self.GetStructurePcdInfo(S_PcdSet) + StrPcdSet =3D DscBuildData.GetStructurePcdInfo(S_PcdSet) S_pcd_set =3D OrderedDict() for str_pcd in StrPcdSet: str_pcd_obj =3D Pcds.get((str_pcd[1], str_pcd[0]), None) -- 2.16.2.windows.1