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=jaben.carsey@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 04647226C7C35 for ; Tue, 3 Apr 2018 14:03:12 -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 orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 14:03:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,402,1517904000"; d="scan'208";a="47710166" 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 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Tue, 3 Apr 2018 14:03:05 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v1 05/10] BaseTools - AutoGen - replace custom dictionary class with python standard one 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: Tue, 03 Apr 2018 21:03:12 -0000 We have a custom ordered dictionary class. works fine with python OrderedDict version. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 31 ++++++++++---------- BaseTools/Source/Python/AutoGen/GenMake.py | 3 +- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 3384fdb70b7e..3865827f26df 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -45,6 +45,7 @@ import InfSectionParser import datetime import hashlib from GenVar import VariableMgr,var_info +from collections import OrderedDict ## Regular expression for splitting Dependency Expression string into tokens gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)") @@ -892,7 +893,7 @@ class WorkspaceAutoGen(AutoGen): ] # This dict store PCDs which are not used by any modules with specified arches - UnusedPcd = sdict() + UnusedPcd = OrderedDict() for Pa in self.AutoGenObjectList: # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid for Pcd in Pa.Platform.Pcds: @@ -2084,7 +2085,7 @@ class PlatformAutoGen(AutoGen): ## Generate Token Number for all PCD def _GetPcdTokenNumbers(self): if self._PcdTokenNumber is None: - self._PcdTokenNumber = sdict() + self._PcdTokenNumber = OrderedDict() TokenNumber = 1 # # Make the Dynamic and DynamicEx PCD use within different TokenNumber area. @@ -2207,8 +2208,8 @@ class PlatformAutoGen(AutoGen): # EdkII module LibraryConsumerList = [Module] Constructor = [] - ConsumedByList = sdict() - LibraryInstance = sdict() + ConsumedByList = OrderedDict() + LibraryInstance = OrderedDict() EdkLogger.verbose("") EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), self.Arch)) @@ -2880,14 +2881,14 @@ class ModuleAutoGen(AutoGen): self._DerivedPackageList = None self._ModulePcdList = None self._LibraryPcdList = None - self._PcdComments = sdict() + self._PcdComments = OrderedDict() self._GuidList = None self._GuidsUsedByPcd = None - self._GuidComments = sdict() + self._GuidComments = OrderedDict() self._ProtocolList = None - self._ProtocolComments = sdict() + self._ProtocolComments = OrderedDict() self._PpiList = None - self._PpiComments = sdict() + self._PpiComments = OrderedDict() self._DepexList = None self._DepexExpressionList = None self._BuildOption = None @@ -2943,7 +2944,7 @@ class ModuleAutoGen(AutoGen): # Macros could be used in build_rule.txt (also Makefile) def _GetMacros(self): if self._Macro is None: - self._Macro = sdict() + self._Macro = OrderedDict() self._Macro["WORKSPACE" ] = self.WorkspaceDir self._Macro["MODULE_NAME" ] = self.Name self._Macro["MODULE_NAME_GUID" ] = self._GetUniqueBaseName() @@ -3695,7 +3696,7 @@ class ModuleAutoGen(AutoGen): # def _GetLibraryPcdList(self): if self._LibraryPcdList is None: - Pcds = sdict() + Pcds = OrderedDict() if not self.IsLibrary: # get PCDs from dependent libraries for Library in self.DependentLibraryList: @@ -3717,7 +3718,7 @@ class ModuleAutoGen(AutoGen): # def _GetGuidList(self): if self._GuidList is None: - self._GuidList = sdict() + self._GuidList = OrderedDict() self._GuidList.update(self.Module.Guids) for Library in self.DependentLibraryList: self._GuidList.update(Library.Guids) @@ -3727,7 +3728,7 @@ class ModuleAutoGen(AutoGen): def GetGuidsUsedByPcd(self): if self._GuidsUsedByPcd is None: - self._GuidsUsedByPcd = sdict() + self._GuidsUsedByPcd = OrderedDict() self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd()) for Library in self.DependentLibraryList: self._GuidsUsedByPcd.update(Library.GetGuidsUsedByPcd()) @@ -3738,7 +3739,7 @@ class ModuleAutoGen(AutoGen): # def _GetProtocolList(self): if self._ProtocolList is None: - self._ProtocolList = sdict() + self._ProtocolList = OrderedDict() self._ProtocolList.update(self.Module.Protocols) for Library in self.DependentLibraryList: self._ProtocolList.update(Library.Protocols) @@ -3752,7 +3753,7 @@ class ModuleAutoGen(AutoGen): # def _GetPpiList(self): if self._PpiList is None: - self._PpiList = sdict() + self._PpiList = OrderedDict() self._PpiList.update(self.Module.Ppis) for Library in self.DependentLibraryList: self._PpiList.update(Library.Ppis) @@ -3983,7 +3984,7 @@ class ModuleAutoGen(AutoGen): PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx')) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic')) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) - GuidList = sdict() + GuidList = OrderedDict() GuidList.update(self.GuidList) for TokenSpace in self.GetGuidsUsedByPcd(): # If token space is not referred by patch PCD or Ex PCD, remove the GUID from GUID list diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index dcdfcca1a5b0..533fdb54231c 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -25,6 +25,7 @@ from Common.Misc import * from Common.String import * from BuildEngine import * import Common.GlobalData as GlobalData +from collections import OrderedDict ## Regular expression for finding header file inclusions gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) @@ -442,7 +443,7 @@ cleanlib: self.LibraryMakefileList = [] self.LibraryBuildDirectoryList = [] self.SystemLibraryList = [] - self.Macros = sdict() + self.Macros = OrderedDict() self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"] self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"] self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"] -- 2.16.2.windows.1