From nobody Fri Nov 1 03:36:49 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 1522789410030572.9294690139145; Tue, 3 Apr 2018 14:03:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F1750226085BC; Tue, 3 Apr 2018 14:03:14 -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 3BC4221FB7D5E 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="47710172" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 14:03:07 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 07/10] BaseTools: 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/Common/DscClassObject.py | 4 ++-- BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py | 10 ++++---- BaseTools/Source/Python/CommonDataClass/PackageClass.py | 4 ++-- BaseTools/Source/Python/Eot/EotGlobalData.py | 10 ++++---- BaseTools/Source/Python/Eot/Parser.py | 3 +-- BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 ++-- BaseTools/Source/Python/Workspace/DecBuildData.py | 24 ++++++++++---= ------- BaseTools/Source/Python/build/build.py | 10 ++++---- 8 files changed, 35 insertions(+), 34 deletions(-) diff --git a/BaseTools/Source/Python/Common/DscClassObject.py b/BaseTools/S= ource/Python/Common/DscClassObject.py index da3101ae0fe9..cff9ab0eefb2 100644 --- a/BaseTools/Source/Python/Common/DscClassObject.py +++ b/BaseTools/Source/Python/Common/DscClassObject.py @@ -25,7 +25,7 @@ from Dictionary import * from CommonDataClass.PlatformClass import * from CommonDataClass.CommonClass import SkuInfoClass from BuildToolError import * -from Misc import sdict +from collections import OrderedDict import GlobalData from Table.TableDsc import TableDsc from Common.LongFilePathSupport import OpenLongFilePath as open @@ -732,7 +732,7 @@ class Dsc(object): # def GenComponents(self, ContainerFile): EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS) - Components =3D sdict() + Components =3D OrderedDict() # # Get all include files # diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py b/BaseTo= ols/Source/Python/Common/EdkIIWorkspaceBuild.py index c0966d526519..c4f45b7c59c2 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py @@ -22,7 +22,7 @@ from DecClassObject import * from DscClassObject import * from String import * from BuildToolError import * -from Misc import sdict +from collections import OrderedDict import Database as Database import time as time =20 @@ -189,7 +189,7 @@ class ModuleBuildClassObject(object): =20 self.Binaries =3D [] self.Sources =3D [] - self.LibraryClasses =3D sdict() + self.LibraryClasses =3D OrderedDict() self.Libraries =3D [] self.Protocols =3D [] self.Ppis =3D [] @@ -955,8 +955,8 @@ class WorkspaceBuild(object): # EdkII module LibraryConsumerList =3D [Module] Constructor =3D [] - ConsumedByList =3D sdict() - LibraryInstance =3D sdict() + ConsumedByList =3D OrderedDict() + LibraryInstance =3D OrderedDict() =20 EdkLogger.verbose("") EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), Arch)) @@ -1097,7 +1097,7 @@ class WorkspaceBuild(object): # The DAG Topo sort produces the destructor order, so the list of = constructors must generated in the reverse order # SortedLibraryList.reverse() - Module.LibraryClasses =3D sdict() + Module.LibraryClasses =3D OrderedDict() for L in SortedLibraryList: for Lc in L.LibraryClass: Module.LibraryClasses[Lc.LibraryClass, ModuleType] =3D str= (L) diff --git a/BaseTools/Source/Python/CommonDataClass/PackageClass.py b/Base= Tools/Source/Python/CommonDataClass/PackageClass.py index 89d4d0797fe1..ba7d7eb67911 100644 --- a/BaseTools/Source/Python/CommonDataClass/PackageClass.py +++ b/BaseTools/Source/Python/CommonDataClass/PackageClass.py @@ -14,7 +14,7 @@ # Import Modules # from CommonClass import * -from Common.Misc import sdict +from collections import OrderedDict =20 ## PackageHeaderClass # @@ -107,7 +107,7 @@ class PackageClass(object): self.IndustryStdHeaders =3D [] self.ModuleFiles =3D [] # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj} - self.Modules =3D sdict() + self.Modules =3D OrderedDict() self.PackageIncludePkgHeaders =3D [] self.GuidDeclarations =3D [] self.ProtocolDeclarations =3D [] diff --git a/BaseTools/Source/Python/Eot/EotGlobalData.py b/BaseTools/Sourc= e/Python/Eot/EotGlobalData.py index dea4206e9d48..7689b76da9d6 100644 --- a/BaseTools/Source/Python/Eot/EotGlobalData.py +++ b/BaseTools/Source/Python/Eot/EotGlobalData.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. # =20 -from Common.Misc import sdict +from collections import OrderedDict from Common.LongFilePathSupport import OpenLongFilePath as open =20 gEFI_SOURCE =3D '' @@ -79,12 +79,12 @@ gPpiList =3D {} gProtocolList =3D {} =20 # Dict for consumed PPI function calling -gConsumedPpiLibrary =3D sdict() +gConsumedPpiLibrary =3D OrderedDict() gConsumedPpiLibrary['EfiCommonLocateInterface'] =3D 0 gConsumedPpiLibrary['PeiServicesLocatePpi'] =3D 0 =20 # Dict for produced PROTOCOL function calling -gProducedProtocolLibrary =3D sdict() +gProducedProtocolLibrary =3D OrderedDict() gProducedProtocolLibrary['RegisterEsalClass'] =3D 0 gProducedProtocolLibrary['CoreInstallProtocolInterface'] =3D 1 gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] =3D -1 @@ -95,14 +95,14 @@ gProducedProtocolLibrary['LibInstallProtocolInterfaces'= ] =3D 1 gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] =3D 1 =20 # Dict for consumed PROTOCOL function calling -gConsumedProtocolLibrary =3D sdict() +gConsumedProtocolLibrary =3D OrderedDict() gConsumedProtocolLibrary['EfiHandleProtocol'] =3D 0 gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] =3D 0 gConsumedProtocolLibrary['EfiLocateProtocolInterface'] =3D 0 gConsumedProtocolLibrary['EfiHandleProtocol'] =3D 1 =20 # Dict for callback PROTOCOL function callling -gCallbackProtocolLibrary =3D sdict() +gCallbackProtocolLibrary =3D OrderedDict() gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] =3D 2 =20 # Dict for ARCH PROTOCOL diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Pytho= n/Eot/Parser.py index ab19e30b69aa..14c287588a01 100644 --- a/BaseTools/Source/Python/Eot/Parser.py +++ b/BaseTools/Source/Python/Eot/Parser.py @@ -21,7 +21,6 @@ from Common.DataType import * from CommonDataClass.DataClass import * from Common.String import CleanString, GetSplitValueList, ReplaceMacro import EotGlobalData -from Common.Misc import sdict from Common.String import GetSplitList from Common.LongFilePathSupport import OpenLongFilePath as open =20 @@ -623,7 +622,7 @@ def SearchProtocols(SqlCommand, Table, SourceFileID, So= urceFileFullPath, ItemMod # @param ItemMode: Mode of item # def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemTyp= e, ItemMode): - LibraryList =3D sdict() + LibraryList =3D {} Db =3D EotGlobalData.gDb.TblReport Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunctio= n =3D [], '', '', '', '', '' if ItemType =3D=3D 'Protocol' and ItemMode =3D=3D 'Produced': diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTo= ols/Source/Python/Workspace/BuildClassObject.py index 90c8246806d8..e95a8fd24b94 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -13,7 +13,7 @@ =20 import Common.LongFilePathOs as os =20 -from Common.Misc import sdict +from collections import OrderedDict from Common.Misc import RealPath2 from Common.BuildToolError import * from Common.DataType import * @@ -281,7 +281,7 @@ class ModuleBuildClassObject(object): =20 self.Binaries =3D [] self.Sources =3D [] - self.LibraryClasses =3D sdict() + self.LibraryClasses =3D OrderedDict() self.Libraries =3D [] self.Protocols =3D [] self.Ppis =3D [] diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/= Source/Python/Workspace/DecBuildData.py index 49ef1df4aa76..ccd6cc6a3754 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -199,9 +199,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) ProtocolDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Protocols =3D sdict() - self._PrivateProtocols =3D sdict() + # use OrderedDict to keep the order + self._Protocols =3D OrderedDict() + self._PrivateProtocols =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -241,9 +241,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) PpiDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Ppis =3D sdict() - self._PrivatePpis =3D sdict() + # use OrderedDict to keep the order + self._Ppis =3D OrderedDict() + self._PrivatePpis =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -283,9 +283,9 @@ class DecBuildData(PackageBuildClassObject): if Name not in NameList: NameList.append(Name) GuidDict[Arch, Name] =3D Guid - # use sdict to keep the order - self._Guids =3D sdict() - self._PrivateGuids =3D sdict() + # use OrderedDict to keep the order + self._Guids =3D OrderedDict() + self._PrivateGuids =3D OrderedDict() for Name in NameList: # # limit the ARCH to self._Arch, if no self._Arch found, td= ict @@ -350,7 +350,7 @@ class DecBuildData(PackageBuildClassObject): EdkLogger.error('build', ErrorCode, ExtraData=3DErrorI= nfo, File=3Dself.MetaFile, Line=3DLineNo) LibraryClassSet.add(LibraryClass) LibraryClassDict[Arch, LibraryClass] =3D File - self._LibraryClasses =3D sdict() + self._LibraryClasses =3D OrderedDict() for LibraryClass in LibraryClassSet: self._LibraryClasses[LibraryClass] =3D LibraryClassDict[se= lf._Arch, LibraryClass] return self._LibraryClasses @@ -358,7 +358,7 @@ class DecBuildData(PackageBuildClassObject): ## Retrieve PCD declarations def _GetPcds(self): if self._Pcds is None: - self._Pcds =3D sdict() + self._Pcds =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)) @@ -399,7 +399,7 @@ class DecBuildData(PackageBuildClassObject): =20 ## Retrieve PCD declarations for given type def _GetPcd(self, Type): - Pcds =3D sdict() + Pcds =3D OrderedDict() # # tdict is a special kind of dict, used for selecting correct # PCD declaration for given ARCH diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index f211f8c64116..4aca28098462 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -53,6 +53,8 @@ import Common.EdkLogger import Common.GlobalData as GlobalData from GenFds.GenFds import GenFds =20 +from collections import OrderedDict + # Version and Copyright VersionNumber =3D "0.60" + ' ' + gBUILD_VERSION __version__ =3D "%prog Version " + VersionNumber @@ -438,19 +440,19 @@ class PlatformMakeUnit(BuildUnit): # class BuildTask: # queue for tasks waiting for schedule - _PendingQueue =3D sdict() + _PendingQueue =3D OrderedDict() _PendingQueueLock =3D threading.Lock() =20 # queue for tasks ready for running - _ReadyQueue =3D sdict() + _ReadyQueue =3D OrderedDict() _ReadyQueueLock =3D threading.Lock() =20 # queue for run tasks - _RunningQueue =3D sdict() + _RunningQueue =3D OrderedDict() _RunningQueueLock =3D threading.Lock() =20 # queue containing all build tasks, in case duplicate build - _TaskQueue =3D sdict() + _TaskQueue =3D OrderedDict() =20 # flag indicating error occurs in a running thread _ErrorFlag =3D threading.Event() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel