diff options
author | Carsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben> | 2018-04-04 05:03:05 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-04-08 14:50:16 +0800 |
commit | 9006a2c6a35bfa607ddaa6d6c2a0738b65f6da97 (patch) | |
tree | ab72c2fa634967a1d93e50f5e9f6d75b35e87fdd /BaseTools | |
parent | 386eb9d7935505ff13b07379832a02fe971ff61c (diff) | |
download | edk2-9006a2c6a35bfa607ddaa6d6c2a0738b65f6da97.tar.gz edk2-9006a2c6a35bfa607ddaa6d6c2a0738b65f6da97.tar.bz2 edk2-9006a2c6a35bfa607ddaa6d6c2a0738b65f6da97.zip |
BaseTools - AutoGen - replace custom dictionary class with python standard one
We have a custom ordered dictionary class. works fine with python OrderedDict version.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/AutoGen.py | 31 | ||||
-rw-r--r-- | 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 3384fdb70b..3865827f26 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 dcdfcca1a5..533fdb5423 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"]
|