]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: use built in OrderedDict instead of custom version.
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Tue, 3 Apr 2018 21:03:07 +0000 (05:03 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sun, 8 Apr 2018 06:50:17 +0000 (14:50 +0800)
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>
BaseTools/Source/Python/Common/DscClassObject.py
BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
BaseTools/Source/Python/CommonDataClass/PackageClass.py
BaseTools/Source/Python/Eot/EotGlobalData.py
BaseTools/Source/Python/Eot/Parser.py
BaseTools/Source/Python/Workspace/BuildClassObject.py
BaseTools/Source/Python/Workspace/DecBuildData.py
BaseTools/Source/Python/build/build.py

index da3101ae0fe9b70d44af6c1904103d3ae6ad2f30..cff9ab0eefb28c0da01159efa387dd01b55932a2 100644 (file)
@@ -25,7 +25,7 @@ from Dictionary import *
 from CommonDataClass.PlatformClass import *\r
 from CommonDataClass.CommonClass import SkuInfoClass\r
 from BuildToolError import *\r
-from Misc import sdict\r
+from collections import OrderedDict\r
 import GlobalData\r
 from Table.TableDsc import TableDsc\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
@@ -732,7 +732,7 @@ class Dsc(object):
     #\r
     def GenComponents(self, ContainerFile):\r
         EdkLogger.debug(2, "Generate %s ..." % TAB_COMPONENTS)\r
-        Components = sdict()\r
+        Components = OrderedDict()\r
         #\r
         # Get all include files\r
         #\r
index c0966d5265190e748d90248f86d8b367d2284a0c..c4f45b7c59c223b1ea354e29b1dcea0573551b84 100644 (file)
@@ -22,7 +22,7 @@ from DecClassObject import *
 from DscClassObject import *\r
 from String import *\r
 from BuildToolError import *\r
-from Misc import sdict\r
+from collections import OrderedDict\r
 import Database as Database\r
 import time as time\r
 \r
@@ -189,7 +189,7 @@ class ModuleBuildClassObject(object):
 \r
         self.Binaries                = []\r
         self.Sources                 = []\r
-        self.LibraryClasses          = sdict()\r
+        self.LibraryClasses          = OrderedDict()\r
         self.Libraries               = []\r
         self.Protocols               = []\r
         self.Ppis                    = []\r
@@ -955,8 +955,8 @@ class WorkspaceBuild(object):
         # EdkII module\r
         LibraryConsumerList = [Module]\r
         Constructor         = []\r
-        ConsumedByList      = sdict()\r
-        LibraryInstance     = sdict()\r
+        ConsumedByList      = OrderedDict()\r
+        LibraryInstance     = OrderedDict()\r
 \r
         EdkLogger.verbose("")\r
         EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(Module), Arch))\r
@@ -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\r
         #\r
         SortedLibraryList.reverse()\r
-        Module.LibraryClasses = sdict()\r
+        Module.LibraryClasses = OrderedDict()\r
         for L in SortedLibraryList:\r
             for Lc in L.LibraryClass:\r
                 Module.LibraryClasses[Lc.LibraryClass, ModuleType] = str(L)\r
index 89d4d0797fe175abd5c1a4f28db52b114b3f0f35..ba7d7eb67911ddbf53030c9e54037dd0a94c2f80 100644 (file)
@@ -14,7 +14,7 @@
 # Import Modules\r
 #\r
 from CommonClass import *\r
-from Common.Misc import sdict\r
+from collections import OrderedDict\r
 \r
 ## PackageHeaderClass\r
 #\r
@@ -107,7 +107,7 @@ class PackageClass(object):
         self.IndustryStdHeaders = []\r
         self.ModuleFiles = []\r
         # {[Guid, Value, Path(relative to WORKSPACE)]: ModuleClassObj}\r
-        self.Modules = sdict()\r
+        self.Modules = OrderedDict()\r
         self.PackageIncludePkgHeaders = []\r
         self.GuidDeclarations = []\r
         self.ProtocolDeclarations = []\r
index dea4206e9d487cdd818bf41ef0c7df1828d95a5d..7689b76da9d64af5aae949074689996b88df9af3 100644 (file)
@@ -11,7 +11,7 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 #\r
 \r
-from Common.Misc import sdict\r
+from collections import OrderedDict\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 \r
 gEFI_SOURCE = ''\r
@@ -79,12 +79,12 @@ gPpiList = {}
 gProtocolList = {}\r
 \r
 # Dict for consumed PPI function calling\r
-gConsumedPpiLibrary = sdict()\r
+gConsumedPpiLibrary = OrderedDict()\r
 gConsumedPpiLibrary['EfiCommonLocateInterface'] = 0\r
 gConsumedPpiLibrary['PeiServicesLocatePpi'] = 0\r
 \r
 # Dict for produced PROTOCOL function calling\r
-gProducedProtocolLibrary = sdict()\r
+gProducedProtocolLibrary = OrderedDict()\r
 gProducedProtocolLibrary['RegisterEsalClass'] = 0\r
 gProducedProtocolLibrary['CoreInstallProtocolInterface'] = 1\r
 gProducedProtocolLibrary['CoreInstallMultipleProtocolInterfaces'] = -1\r
@@ -95,14 +95,14 @@ gProducedProtocolLibrary['LibInstallProtocolInterfaces'] = 1
 gProducedProtocolLibrary['LibReinstallProtocolInterfaces'] = 1\r
 \r
 # Dict for consumed PROTOCOL function calling\r
-gConsumedProtocolLibrary = sdict()\r
+gConsumedProtocolLibrary = OrderedDict()\r
 gConsumedProtocolLibrary['EfiHandleProtocol'] = 0\r
 gConsumedProtocolLibrary['EfiLocateProtocolHandleBuffers'] = 0\r
 gConsumedProtocolLibrary['EfiLocateProtocolInterface'] = 0\r
 gConsumedProtocolLibrary['EfiHandleProtocol'] = 1\r
 \r
 # Dict for callback PROTOCOL function callling\r
-gCallbackProtocolLibrary = sdict()\r
+gCallbackProtocolLibrary = OrderedDict()\r
 gCallbackProtocolLibrary['EfiRegisterProtocolCallback'] = 2\r
 \r
 # Dict for ARCH PROTOCOL\r
index ab19e30b69aa1c0749a4d160c27ae94c5918761b..14c287588a017b37e16ca4ec9f09b756947ea943 100644 (file)
@@ -21,7 +21,6 @@ from Common.DataType import *
 from CommonDataClass.DataClass import *\r
 from Common.String import CleanString, GetSplitValueList, ReplaceMacro\r
 import EotGlobalData\r
-from Common.Misc import sdict\r
 from Common.String import GetSplitList\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 \r
@@ -623,7 +622,7 @@ def SearchProtocols(SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemMod
 #  @param ItemMode: Mode of item\r
 #\r
 def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemType, ItemMode):\r
-    LibraryList = sdict()\r
+    LibraryList = {}\r
     Db = EotGlobalData.gDb.TblReport\r
     Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunction = [], '', '', '', '', ''\r
     if ItemType == 'Protocol' and ItemMode == 'Produced':\r
index 90c8246806d86e3fd6451e4be8c249ddcd1172b7..e95a8fd24b946d92b7d5b4d730f50a391e3f667a 100644 (file)
@@ -13,7 +13,7 @@
 \r
 import Common.LongFilePathOs as os\r
 \r
-from Common.Misc import sdict\r
+from collections import OrderedDict\r
 from Common.Misc import RealPath2\r
 from Common.BuildToolError import *\r
 from Common.DataType import *\r
@@ -281,7 +281,7 @@ class ModuleBuildClassObject(object):
 \r
         self.Binaries                = []\r
         self.Sources                 = []\r
-        self.LibraryClasses          = sdict()\r
+        self.LibraryClasses          = OrderedDict()\r
         self.Libraries               = []\r
         self.Protocols               = []\r
         self.Ppis                    = []\r
index 49ef1df4aa76bb8e11e06b70e18fb9a826899f5d..ccd6cc6a3754bff1a4492eac09b9990e22f7066e 100644 (file)
@@ -199,9 +199,9 @@ class DecBuildData(PackageBuildClassObject):
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 ProtocolDict[Arch, Name] = Guid\r
-            # use sdict to keep the order\r
-            self._Protocols = sdict()\r
-            self._PrivateProtocols = sdict()\r
+            # use OrderedDict to keep the order\r
+            self._Protocols = OrderedDict()\r
+            self._PrivateProtocols = OrderedDict()\r
             for Name in NameList:\r
                 #\r
                 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
@@ -241,9 +241,9 @@ class DecBuildData(PackageBuildClassObject):
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 PpiDict[Arch, Name] = Guid\r
-            # use sdict to keep the order\r
-            self._Ppis = sdict()\r
-            self._PrivatePpis = sdict()\r
+            # use OrderedDict to keep the order\r
+            self._Ppis = OrderedDict()\r
+            self._PrivatePpis = OrderedDict()\r
             for Name in NameList:\r
                 #\r
                 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
@@ -283,9 +283,9 @@ class DecBuildData(PackageBuildClassObject):
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 GuidDict[Arch, Name] = Guid\r
-            # use sdict to keep the order\r
-            self._Guids = sdict()\r
-            self._PrivateGuids = sdict()\r
+            # use OrderedDict to keep the order\r
+            self._Guids = OrderedDict()\r
+            self._PrivateGuids = OrderedDict()\r
             for Name in NameList:\r
                 #\r
                 # limit the ARCH to self._Arch, if no self._Arch found, tdict\r
@@ -350,7 +350,7 @@ class DecBuildData(PackageBuildClassObject):
                     EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
                 LibraryClassSet.add(LibraryClass)\r
                 LibraryClassDict[Arch, LibraryClass] = File\r
-            self._LibraryClasses = sdict()\r
+            self._LibraryClasses = OrderedDict()\r
             for LibraryClass in LibraryClassSet:\r
                 self._LibraryClasses[LibraryClass] = LibraryClassDict[self._Arch, LibraryClass]\r
         return self._LibraryClasses\r
@@ -358,7 +358,7 @@ class DecBuildData(PackageBuildClassObject):
     ## Retrieve PCD declarations\r
     def _GetPcds(self):\r
         if self._Pcds is None:\r
-            self._Pcds = sdict()\r
+            self._Pcds = OrderedDict()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))\r
@@ -399,7 +399,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve PCD declarations for given type\r
     def _GetPcd(self, Type):\r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         #\r
         # tdict is a special kind of dict, used for selecting correct\r
         # PCD declaration for given ARCH\r
index f211f8c641167ae2894e6370dc719ef52d1fae44..4aca280984625e4fd7dc938b2ed57e1a6efec362 100644 (file)
@@ -53,6 +53,8 @@ import Common.EdkLogger
 import Common.GlobalData as GlobalData\r
 from GenFds.GenFds import GenFds\r
 \r
+from collections import OrderedDict\r
+\r
 # Version and Copyright\r
 VersionNumber = "0.60" + ' ' + gBUILD_VERSION\r
 __version__ = "%prog Version " + VersionNumber\r
@@ -438,19 +440,19 @@ class PlatformMakeUnit(BuildUnit):
 #\r
 class BuildTask:\r
     # queue for tasks waiting for schedule\r
-    _PendingQueue = sdict()\r
+    _PendingQueue = OrderedDict()\r
     _PendingQueueLock = threading.Lock()\r
 \r
     # queue for tasks ready for running\r
-    _ReadyQueue = sdict()\r
+    _ReadyQueue = OrderedDict()\r
     _ReadyQueueLock = threading.Lock()\r
 \r
     # queue for run tasks\r
-    _RunningQueue = sdict()\r
+    _RunningQueue = OrderedDict()\r
     _RunningQueueLock = threading.Lock()\r
 \r
     # queue containing all build tasks, in case duplicate build\r
-    _TaskQueue = sdict()\r
+    _TaskQueue = OrderedDict()\r
 \r
     # flag indicating error occurs in a running thread\r
     _ErrorFlag = threading.Event()\r