From nobody Fri Nov 1 03:38:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522789415588187.5266547005382; Tue, 3 Apr 2018 14:03:35 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 550C0226085C1; Tue, 3 Apr 2018 14:03:15 -0700 (PDT) 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 5E017221467CC for ; Tue, 3 Apr 2018 14:03:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2018 14:03:11 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710180" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:09 -0700 Message-Id: <6d37f464fcf3d4472de025ce538bdeba325c19cb.1522789210.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 09/10] BaseTools: Workspace - use built in OrderedDict instead of custom version. 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: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We dont use any feature added by custom dictionary class. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Workspace/DscBuildData.py | 24 ++++----- BaseTools/Source/Python/Workspace/InfBuildData.py | 52 +++++++++-------= ---- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 3 +- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index cf9608651269..6766f059b0f7 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -635,7 +635,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve [SkuIds] section information def _GetSkuIds(self): if self._SkuIds is None: - self._SkuIds =3D sdict() + self._SkuIds =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_SKU_ID, self._Arch] for Record in RecordList: if Record[0] in [None, '']: @@ -662,7 +662,7 @@ class DscBuildData(PlatformBuildClassObject): return int(intstr,16) if intstr.upper().startswith("0X") else int(= intstr) def _GetDefaultStores(self): if self.DefaultStores is None: - self.DefaultStores =3D sdict() + self.DefaultStores =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_DEFAULT_STORES, self._A= rch] for Record in RecordList: if Record[0] in [None, '']: @@ -692,7 +692,7 @@ class DscBuildData(PlatformBuildClassObject): if self._Modules is not None: return self._Modules =20 - self._Modules =3D sdict() + self._Modules =3D OrderedDict() RecordList =3D self._RawData[MODEL_META_DATA_COMPONENT, self._Arch] Macros =3D self._Macros Macros["EDK_SOURCE"] =3D GlobalData.gEcpSource @@ -1122,7 +1122,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve all PCD settings in platform def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() + self._Pcds =3D OrderedDict() self.__ParsePcdFromCommandLine() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) @@ -1157,7 +1157,7 @@ class DscBuildData(PlatformBuildClassObject): ## Retrieve [BuildOptions] def _GetBuildOptions(self): if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() # # Retrieve build option for EDKII and EDK style module # @@ -1179,9 +1179,9 @@ class DscBuildData(PlatformBuildClassObject): =20 def GetBuildOptionsByModuleType(self, Edk, ModuleType): if self._ModuleTypeOptions is None: - self._ModuleTypeOptions =3D sdict() + self._ModuleTypeOptions =3D OrderedDict() if (Edk, ModuleType) not in self._ModuleTypeOptions: - options =3D sdict() + options =3D OrderedDict() self._ModuleTypeOptions[Edk, ModuleType] =3D options DriverType =3D '%s.%s' % (Edk, ModuleType) CommonDriverType =3D '%s.%s' % ('COMMON', ModuleType) @@ -1446,7 +1446,7 @@ class DscBuildData(PlatformBuildClassObject): # @retval a dict object contains settings of given PCD type # def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH @@ -1457,7 +1457,7 @@ class DscBuildData(PlatformBuildClassObject): PcdSet =3D set() # Find out all possible PCD candidates for self._Arch RecordList =3D self._RawData[Type, self._Arch] - PcdValueDict =3D sdict() + PcdValueDict =3D OrderedDict() for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dumm= y4,Dummy5 in RecordList: SkuName =3D SkuName.upper() SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName @@ -2230,7 +2230,7 @@ class DscBuildData(PlatformBuildClassObject): def _GetDynamicPcd(self, Type): =20 =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU @@ -2395,7 +2395,7 @@ class DscBuildData(PlatformBuildClassObject): =20 VariableAttrs =3D {} =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU @@ -2557,7 +2557,7 @@ class DscBuildData(PlatformBuildClassObject): def _GetDynamicVpdPcd(self, Type): =20 =20 - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index ded8f610c9c1..a7ffd43a0972 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by build tool # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License @@ -17,6 +17,7 @@ from Common.DataType import * from Common.Misc import * from types import * from MetaFileParser import * +from collections import OrderedDict =20 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject ## Module build information from INF file @@ -156,7 +157,7 @@ class InfBuildData(ModuleBuildClassObject): self._ModuleUnloadImageList =3D None self._ConstructorList =3D None self._DestructorList =3D None - self._Defs =3D None + self._Defs =3D OrderedDict() self._Binaries =3D None self._Sources =3D None self._LibraryClasses =3D None @@ -166,7 +167,7 @@ class InfBuildData(ModuleBuildClassObject): self._Ppis =3D None self._PpiComments =3D None self._Guids =3D None - self._GuidsUsedByPcd =3D sdict() + self._GuidsUsedByPcd =3D OrderedDict() self._GuidComments =3D None self._Includes =3D None self._Packages =3D None @@ -246,8 +247,6 @@ class InfBuildData(ModuleBuildClassObject): # items defined _PROPERTY_ don't need additional processing if Name in self: self[Name] =3D Value - if self._Defs is None: - self._Defs =3D sdict() self._Defs[Name] =3D Value self._Macros[Name] =3D Value # some special items in [Defines] section need special treatme= nt @@ -255,7 +254,7 @@ class InfBuildData(ModuleBuildClassObject): if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATI= ON_VERSION'): Name =3D 'UEFI_SPECIFICATION_VERSION' if self._Specification is None: - self._Specification =3D sdict() + self._Specification =3D OrderedDict() self._Specification[Name] =3D GetHexVerValue(Value) if self._Specification[Name] is None: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, @@ -307,8 +306,6 @@ class InfBuildData(ModuleBuildClassObject): File=3Dself.MetaFile, Line=3DRecor= d[-1]) self._CustomMakefile[TokenList[0]] =3D TokenList[1] else: - if self._Defs is None: - self._Defs =3D sdict() self._Defs[Name] =3D Value self._Macros[Name] =3D Value =20 @@ -337,14 +334,14 @@ class InfBuildData(ModuleBuildClassObject): EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_COR= E_STANDALONE module type can't be used in the module with PI_SPECIFICATION_= VERSION less than 0x00010032", File=3Dself.MetaFile) if self._ModuleType =3D=3D SUP_MODULE_MM_STANDALONE: EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STA= NDALONE module type can't be used in the module with PI_SPECIFICATION_VERSI= ON less than 0x00010032", File=3Dself.MetaFile) - if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDO= R_ID' in self._Defs \ + if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._= Defs \ and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in se= lf._Defs: self._BuildType =3D 'UEFI_OPTIONROM' if 'PCI_COMPRESS' in self._Defs: if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'): EdkLogger.error("build", FORMAT_INVALID, "Expected= TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile) =20 - elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \ + elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \ and self._Defs['UEFI_HII_RESOURCE_SECTION'] =3D=3D 'TRUE': self._BuildType =3D 'UEFI_HII' else: @@ -398,7 +395,7 @@ class InfBuildData(ModuleBuildClassObject): # File=3Dself.MetaFile, Line=3DLineN= o) else: if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() =20 if ToolList[0] in self._TOOL_CODE_: Tool =3D self._TOOL_CODE_[ToolList[0]] @@ -590,11 +587,8 @@ class InfBuildData(ModuleBuildClassObject): =20 ## Retrieve definies other than above ones def _GetDefines(self): - if self._Defs is None: - if self._Header_ is None: - self._GetHeaderInfo() - if self._Defs is None: - self._Defs =3D sdict() + if len(self._Defs) =3D=3D 0 and self._Header_ is None: + self._GetHeaderInfo() return self._Defs =20 ## Retrieve binary files @@ -688,7 +682,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve library classes employed by this module def _GetLibraryClassUses(self): if self._LibraryClasses is None: - self._LibraryClasses =3D sdict() + self._LibraryClasses =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Ar= ch, self._Platform] for Record in RecordList: Lib =3D Record[0] @@ -717,8 +711,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve protocols consumed/produced by this module def _GetProtocols(self): if self._Protocols is None: - self._Protocols =3D sdict() - self._ProtocolComments =3D sdict() + self._Protocols =3D OrderedDict() + self._ProtocolComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PROTOCOL, self._Arch, s= elf._Platform] for Record in RecordList: CName =3D Record[0] @@ -742,8 +736,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PPIs consumed/produced by this module def _GetPpis(self): if self._Ppis is None: - self._Ppis =3D sdict() - self._PpiComments =3D sdict() + self._Ppis =3D OrderedDict() + self._PpiComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PPI, self._Arch, self._= Platform] for Record in RecordList: CName =3D Record[0] @@ -767,8 +761,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve GUIDs consumed/produced by this module def _GetGuids(self): if self._Guids is None: - self._Guids =3D sdict() - self._GuidComments =3D sdict() + self._Guids =3D OrderedDict() + self._GuidComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_GUID, self._Arch, self.= _Platform] for Record in RecordList: CName =3D Record[0] @@ -869,8 +863,8 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PCDs used in this module def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() - self._PcdComments =3D sdict() + self._Pcds =3D OrderedDict() + self._PcdComments =3D OrderedDict() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG)) @@ -881,7 +875,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve build options specific to this module def _GetBuildOptions(self): if self._BuildOptions is None: - self._BuildOptions =3D sdict() + self._BuildOptions =3D OrderedDict() RecordList =3D self._RawData[MODEL_META_DATA_BUILD_OPTION, sel= f._Arch, self._Platform] for Record in RecordList: ToolChainFamily =3D Record[0] @@ -920,7 +914,7 @@ class InfBuildData(ModuleBuildClassObject): "'%s' module must specify the type= of [Depex] section" % self.ModuleType, File=3Dself.MetaFile) =20 - Depex =3D sdict() + Depex =3D OrderedDict() for Record in RecordList: DepexStr =3D ReplaceMacro(Record[0], self._Macros, False) Arch =3D Record[3] @@ -961,7 +955,7 @@ class InfBuildData(ModuleBuildClassObject): if self._DepexExpression is None: self._DepexExpression =3D tdict(False, 2) RecordList =3D self._RawData[MODEL_EFI_DEPEX, self._Arch] - DepexExpression =3D sdict() + DepexExpression =3D OrderedDict() for Record in RecordList: DepexStr =3D ReplaceMacro(Record[0], self._Macros, False) Arch =3D Record[3] @@ -979,7 +973,7 @@ class InfBuildData(ModuleBuildClassObject): return self._GuidsUsedByPcd ## Retrieve PCD for given type def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() PcdDict =3D tdict(True, 4) PcdList =3D [] RecordList =3D self._RawData[Type, self._Arch, self._Platform] diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 8c27b4ad5b9b..17ac3b105431 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from Common.Misc import sdict from collections import OrderedDict, defaultdict from Common.DataType import SUP_MODULE_USER_DEFINED from BuildClassObject import LibraryClassObject @@ -113,7 +112,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To LibraryConsumerList =3D [Module] Constructor =3D [] ConsumedByList =3D OrderedListDict() - LibraryInstance =3D sdict() + LibraryInstance =3D OrderedDict() =20 while len(LibraryConsumerList) > 0: M =3D LibraryConsumerList.pop() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel