BaseTools: use built in OrderedDict instead of custom version.

We dont use any feature added by custom dictionary class.

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>
This commit is contained in:
Carsey, Jaben 2018-04-04 05:03:07 +08:00 committed by Yonghong Zhu
parent 0d8ff45567
commit 6e6d767edf
8 changed files with 35 additions and 34 deletions

View File

@ -25,7 +25,7 @@ from Dictionary import *
from CommonDataClass.PlatformClass import * from CommonDataClass.PlatformClass import *
from CommonDataClass.CommonClass import SkuInfoClass from CommonDataClass.CommonClass import SkuInfoClass
from BuildToolError import * from BuildToolError import *
from Misc import sdict from collections import OrderedDict
import GlobalData import GlobalData
from Table.TableDsc import TableDsc from Table.TableDsc import TableDsc
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
@ -732,7 +732,7 @@ class Dsc(object):
# #
def GenComponents(self, ContainerFile): def GenComponents(self, ContainerFile):
EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS) EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS)
Components = sdict() Components = OrderedDict()
# #
# Get all include files # Get all include files
# #

View File

@ -22,7 +22,7 @@ from DecClassObject import *
from DscClassObject import * from DscClassObject import *
from String import * from String import *
from BuildToolError import * from BuildToolError import *
from Misc import sdict from collections import OrderedDict
import Database as Database import Database as Database
import time as time import time as time
@ -189,7 +189,7 @@ class ModuleBuildClassObject(object):
self.Binaries = [] self.Binaries = []
self.Sources = [] self.Sources = []
self.LibraryClasses = sdict() self.LibraryClasses = OrderedDict()
self.Libraries = [] self.Libraries = []
self.Protocols = [] self.Protocols = []
self.Ppis = [] self.Ppis = []
@ -955,8 +955,8 @@ class WorkspaceBuild(object):
# EdkII module # EdkII module
LibraryConsumerList = [Module] LibraryConsumerList = [Module]
Constructor = [] Constructor = []
ConsumedByList = sdict() ConsumedByList = OrderedDict()
LibraryInstance = sdict() LibraryInstance = OrderedDict()
EdkLogger.verbose("") EdkLogger.verbose("")
EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch)) 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 # The DAG Topo sort produces the destructor order, so the list of constructors must generated in the reverse order
# #
SortedLibraryList.reverse() SortedLibraryList.reverse()
Module.LibraryClasses = sdict() Module.LibraryClasses = OrderedDict()
for L in SortedLibraryList: for L in SortedLibraryList:
for Lc in L.LibraryClass: for Lc in L.LibraryClass:
Module.LibraryClasses[Lc.LibraryClass, ModuleType] = str(L) Module.LibraryClasses[Lc.LibraryClass, ModuleType] = str(L)

View File

@ -14,7 +14,7 @@
# Import Modules # Import Modules
# #
from CommonClass import * from CommonClass import *
from Common.Misc import sdict from collections import OrderedDict
## PackageHeaderClass ## PackageHeaderClass
# #
@ -107,7 +107,7 @@ class PackageClass(object):
self.IndustryStdHeaders = [] self.IndustryStdHeaders = []
self.ModuleFiles = [] self.ModuleFiles = []
# {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj} # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj}
self.Modules = sdict() self.Modules = OrderedDict()
self.PackageIncludePkgHeaders = [] self.PackageIncludePkgHeaders = []
self.GuidDeclarations = [] self.GuidDeclarations = []
self.ProtocolDeclarations = [] self.ProtocolDeclarations = []

View File

@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
from Common.Misc import sdict from collections import OrderedDict
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
gEFI_SOURCE = '' gEFI_SOURCE = ''
@ -79,12 +79,12 @@ gPpiList = {}
gProtocolList = {} gProtocolList = {}
# Dict for consumed PPI function calling # Dict for consumed PPI function calling
gConsumedPpiLibrary = sdict() gConsumedPpiLibrary = OrderedDict()
gConsumedPpiLibrary['EfiCommonLocateInterface'] = 0 gConsumedPpiLibrary['EfiCommonLocateInterface'] = 0
gConsumedPpiLibrary['PeiServicesLocatePpi'] = 0 gConsumedPpiLibrary['PeiServicesLocatePpi'] = 0
# Dict for produced PROTOCOL function calling # Dict for produced PROTOCOL function calling
gProducedProtocolLibrary = sdict() gProducedProtocolLibrary = OrderedDict()
gProducedProtocolLibrary['RegisterEsalClass'] = 0 gProducedProtocolLibrary['RegisterEsalClass'] = 0
gProducedProtocolLibrary['CoreInstallProtocolInterface'] = 1 gProducedProtocolLibrary['CoreInstallProtocolInterface'] = 1
gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] = -1 gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] = -1
@ -95,14 +95,14 @@ gProducedProtocolLibrary['LibInstallProtocolInterfaces'] = 1
gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] = 1 gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] = 1
# Dict for consumed PROTOCOL function calling # Dict for consumed PROTOCOL function calling
gConsumedProtocolLibrary = sdict() gConsumedProtocolLibrary = OrderedDict()
gConsumedProtocolLibrary['EfiHandleProtocol'] = 0 gConsumedProtocolLibrary['EfiHandleProtocol'] = 0
gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] = 0 gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] = 0
gConsumedProtocolLibrary['EfiLocateProtocolInterface'] = 0 gConsumedProtocolLibrary['EfiLocateProtocolInterface'] = 0
gConsumedProtocolLibrary['EfiHandleProtocol'] = 1 gConsumedProtocolLibrary['EfiHandleProtocol'] = 1
# Dict for callback PROTOCOL function callling # Dict for callback PROTOCOL function callling
gCallbackProtocolLibrary = sdict() gCallbackProtocolLibrary = OrderedDict()
gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] = 2 gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] = 2
# Dict for ARCH PROTOCOL # Dict for ARCH PROTOCOL

View File

@ -21,7 +21,6 @@ from Common.DataType import *
from CommonDataClass.DataClass import * from CommonDataClass.DataClass import *
from Common.String import CleanString, GetSplitValueList, ReplaceMacro from Common.String import CleanString, GetSplitValueList, ReplaceMacro
import EotGlobalData import EotGlobalData
from Common.Misc import sdict
from Common.String import GetSplitList from Common.String import GetSplitList
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
@ -623,7 +622,7 @@ def SearchProtocols(SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemMod
# @param ItemMode: Mode of item # @param ItemMode: Mode of item
# #
def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemType, ItemMode): def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemType, ItemMode):
LibraryList = sdict() LibraryList = {}
Db = EotGlobalData.gDb.TblReport Db = EotGlobalData.gDb.TblReport
Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunction = [], '', '', '', '', '' Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunction = [], '', '', '', '', ''
if ItemType == 'Protocol' and ItemMode == 'Produced': if ItemType == 'Protocol' and ItemMode == 'Produced':

View File

@ -13,7 +13,7 @@
import Common.LongFilePathOs as os import Common.LongFilePathOs as os
from Common.Misc import sdict from collections import OrderedDict
from Common.Misc import RealPath2 from Common.Misc import RealPath2
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.DataType import * from Common.DataType import *
@ -281,7 +281,7 @@ class ModuleBuildClassObject(object):
self.Binaries = [] self.Binaries = []
self.Sources = [] self.Sources = []
self.LibraryClasses = sdict() self.LibraryClasses = OrderedDict()
self.Libraries = [] self.Libraries = []
self.Protocols = [] self.Protocols = []
self.Ppis = [] self.Ppis = []

View File

@ -199,9 +199,9 @@ class DecBuildData(PackageBuildClassObject):
if Name not in NameList: if Name not in NameList:
NameList.append(Name) NameList.append(Name)
ProtocolDict[Arch, Name] = Guid ProtocolDict[Arch, Name] = Guid
# use sdict to keep the order # use OrderedDict to keep the order
self._Protocols = sdict() self._Protocols = OrderedDict()
self._PrivateProtocols = sdict() self._PrivateProtocols = OrderedDict()
for Name in NameList: for Name in NameList:
# #
# limit the ARCH to self._Arch, if no self._Arch found, tdict # limit the ARCH to self._Arch, if no self._Arch found, tdict
@ -241,9 +241,9 @@ class DecBuildData(PackageBuildClassObject):
if Name not in NameList: if Name not in NameList:
NameList.append(Name) NameList.append(Name)
PpiDict[Arch, Name] = Guid PpiDict[Arch, Name] = Guid
# use sdict to keep the order # use OrderedDict to keep the order
self._Ppis = sdict() self._Ppis = OrderedDict()
self._PrivatePpis = sdict() self._PrivatePpis = OrderedDict()
for Name in NameList: for Name in NameList:
# #
# limit the ARCH to self._Arch, if no self._Arch found, tdict # limit the ARCH to self._Arch, if no self._Arch found, tdict
@ -283,9 +283,9 @@ class DecBuildData(PackageBuildClassObject):
if Name not in NameList: if Name not in NameList:
NameList.append(Name) NameList.append(Name)
GuidDict[Arch, Name] = Guid GuidDict[Arch, Name] = Guid
# use sdict to keep the order # use OrderedDict to keep the order
self._Guids = sdict() self._Guids = OrderedDict()
self._PrivateGuids = sdict() self._PrivateGuids = OrderedDict()
for Name in NameList: for Name in NameList:
# #
# limit the ARCH to self._Arch, if no self._Arch found, tdict # limit the ARCH to self._Arch, if no self._Arch found, tdict
@ -350,7 +350,7 @@ class DecBuildData(PackageBuildClassObject):
EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo) EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)
LibraryClassSet.add(LibraryClass) LibraryClassSet.add(LibraryClass)
LibraryClassDict[Arch, LibraryClass] = File LibraryClassDict[Arch, LibraryClass] = File
self._LibraryClasses = sdict() self._LibraryClasses = OrderedDict()
for LibraryClass in LibraryClassSet: for LibraryClass in LibraryClassSet:
self._LibraryClasses[LibraryClass] = LibraryClassDict[self._Arch, LibraryClass] self._LibraryClasses[LibraryClass] = LibraryClassDict[self._Arch, LibraryClass]
return self._LibraryClasses return self._LibraryClasses
@ -358,7 +358,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve PCD declarations ## Retrieve PCD declarations
def _GetPcds(self): def _GetPcds(self):
if self._Pcds is None: if self._Pcds is None:
self._Pcds = sdict() self._Pcds = OrderedDict()
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) 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_PATCHABLE_IN_MODULE))
self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG)) self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
@ -399,7 +399,7 @@ class DecBuildData(PackageBuildClassObject):
## Retrieve PCD declarations for given type ## Retrieve PCD declarations for given type
def _GetPcd(self, Type): def _GetPcd(self, Type):
Pcds = sdict() Pcds = OrderedDict()
# #
# tdict is a special kind of dict, used for selecting correct # tdict is a special kind of dict, used for selecting correct
# PCD declaration for given ARCH # PCD declaration for given ARCH

View File

@ -53,6 +53,8 @@ import Common.EdkLogger
import Common.GlobalData as GlobalData import Common.GlobalData as GlobalData
from GenFds.GenFds import GenFds from GenFds.GenFds import GenFds
from collections import OrderedDict
# Version and Copyright # Version and Copyright
VersionNumber = "0.60" + ' ' + gBUILD_VERSION VersionNumber = "0.60" + ' ' + gBUILD_VERSION
__version__ = "%prog Version " + VersionNumber __version__ = "%prog Version " + VersionNumber
@ -438,19 +440,19 @@ class PlatformMakeUnit(BuildUnit):
# #
class BuildTask: class BuildTask:
# queue for tasks waiting for schedule # queue for tasks waiting for schedule
_PendingQueue = sdict() _PendingQueue = OrderedDict()
_PendingQueueLock = threading.Lock() _PendingQueueLock = threading.Lock()
# queue for tasks ready for running # queue for tasks ready for running
_ReadyQueue = sdict() _ReadyQueue = OrderedDict()
_ReadyQueueLock = threading.Lock() _ReadyQueueLock = threading.Lock()
# queue for run tasks # queue for run tasks
_RunningQueue = sdict() _RunningQueue = OrderedDict()
_RunningQueueLock = threading.Lock() _RunningQueueLock = threading.Lock()
# queue containing all build tasks, in case duplicate build # queue containing all build tasks, in case duplicate build
_TaskQueue = sdict() _TaskQueue = OrderedDict()
# flag indicating error occurs in a running thread # flag indicating error occurs in a running thread
_ErrorFlag = threading.Event() _ErrorFlag = threading.Event()