]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Workspace - 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:09 +0000 (05:03 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sun, 8 Apr 2018 06:50:18 +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/Workspace/DscBuildData.py
BaseTools/Source/Python/Workspace/InfBuildData.py
BaseTools/Source/Python/Workspace/WorkspaceCommon.py

index cf9608651269edbe602618e6a84e1fe4f94526e1..6766f059b0f76942384dc5205b412252f0cda9c1 100644 (file)
@@ -635,7 +635,7 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve [SkuIds] section information\r
     def _GetSkuIds(self):\r
         if self._SkuIds is None:\r
-            self._SkuIds = sdict()\r
+            self._SkuIds = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]\r
             for Record in RecordList:\r
                 if Record[0] in [None, '']:\r
@@ -662,7 +662,7 @@ class DscBuildData(PlatformBuildClassObject):
         return int(intstr,16) if intstr.upper().startswith("0X") else int(intstr)\r
     def _GetDefaultStores(self):\r
         if self.DefaultStores is None:\r
-            self.DefaultStores = sdict()\r
+            self.DefaultStores = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]\r
             for Record in RecordList:\r
                 if Record[0] in [None, '']:\r
@@ -692,7 +692,7 @@ class DscBuildData(PlatformBuildClassObject):
         if self._Modules is not None:\r
             return self._Modules\r
 \r
-        self._Modules = sdict()\r
+        self._Modules = OrderedDict()\r
         RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]\r
         Macros = self._Macros\r
         Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
@@ -1122,7 +1122,7 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve all PCD settings in platform\r
     def _GetPcds(self):\r
         if self._Pcds is None:\r
-            self._Pcds = sdict()\r
+            self._Pcds = OrderedDict()\r
             self.__ParsePcdFromCommandLine()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
@@ -1157,7 +1157,7 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve [BuildOptions]\r
     def _GetBuildOptions(self):\r
         if self._BuildOptions is None:\r
-            self._BuildOptions = sdict()\r
+            self._BuildOptions = OrderedDict()\r
             #\r
             # Retrieve build option for EDKII and EDK style module\r
             #\r
@@ -1179,9 +1179,9 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     def GetBuildOptionsByModuleType(self, Edk, ModuleType):\r
         if self._ModuleTypeOptions is None:\r
-            self._ModuleTypeOptions = sdict()\r
+            self._ModuleTypeOptions = OrderedDict()\r
         if (Edk, ModuleType) not in self._ModuleTypeOptions:\r
-            options = sdict()\r
+            options = OrderedDict()\r
             self._ModuleTypeOptions[Edk, ModuleType] = options\r
             DriverType = '%s.%s' % (Edk, ModuleType)\r
             CommonDriverType = '%s.%s' % ('COMMON', ModuleType)\r
@@ -1446,7 +1446,7 @@ class DscBuildData(PlatformBuildClassObject):
     #   @retval a dict object contains settings of given PCD type\r
     #\r
     def _GetPcd(self, Type):\r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH\r
@@ -1457,7 +1457,7 @@ class DscBuildData(PlatformBuildClassObject):
         PcdSet = set()\r
         # Find out all possible PCD candidates for self._Arch\r
         RecordList = self._RawData[Type, self._Arch]\r
-        PcdValueDict = sdict()\r
+        PcdValueDict = OrderedDict()\r
         for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4,Dummy5 in RecordList:\r
             SkuName = SkuName.upper()\r
             SkuName = 'DEFAULT' if SkuName == 'COMMON' else SkuName\r
@@ -2230,7 +2230,7 @@ class DscBuildData(PlatformBuildClassObject):
     def _GetDynamicPcd(self, Type):\r
 \r
 \r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
@@ -2395,7 +2395,7 @@ class DscBuildData(PlatformBuildClassObject):
 \r
         VariableAttrs = {}\r
 \r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
@@ -2557,7 +2557,7 @@ class DscBuildData(PlatformBuildClassObject):
     def _GetDynamicVpdPcd(self, Type):\r
 \r
 \r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
index ded8f610c9c190e0cd107830418452b2660408c2..a7ffd43a097284ecb0e228f1837d8c71ad9602ee 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to create a database used by build tool\r
 #\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -17,6 +17,7 @@ from Common.DataType import *
 from Common.Misc import *\r
 from types import *\r
 from MetaFileParser import *\r
+from collections import OrderedDict\r
 \r
 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject\r
 ## Module build information from INF file\r
@@ -156,7 +157,7 @@ class InfBuildData(ModuleBuildClassObject):
         self._ModuleUnloadImageList = None\r
         self._ConstructorList       = None\r
         self._DestructorList        = None\r
-        self._Defs                  = None\r
+        self._Defs                  = OrderedDict()\r
         self._Binaries              = None\r
         self._Sources               = None\r
         self._LibraryClasses        = None\r
@@ -166,7 +167,7 @@ class InfBuildData(ModuleBuildClassObject):
         self._Ppis                  = None\r
         self._PpiComments           = None\r
         self._Guids                 = None\r
-        self._GuidsUsedByPcd        = sdict()\r
+        self._GuidsUsedByPcd        = OrderedDict()\r
         self._GuidComments          = None\r
         self._Includes              = None\r
         self._Packages              = None\r
@@ -246,8 +247,6 @@ class InfBuildData(ModuleBuildClassObject):
             # items defined _PROPERTY_ don't need additional processing\r
             if Name in self:\r
                 self[Name] = Value\r
-                if self._Defs is None:\r
-                    self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
                 self._Macros[Name] = Value\r
             # some special items in [Defines] section need special treatment\r
@@ -255,7 +254,7 @@ class InfBuildData(ModuleBuildClassObject):
                 if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):\r
                     Name = 'UEFI_SPECIFICATION_VERSION'\r
                 if self._Specification is None:\r
-                    self._Specification = sdict()\r
+                    self._Specification = OrderedDict()\r
                 self._Specification[Name] = GetHexVerValue(Value)\r
                 if self._Specification[Name] is None:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
@@ -307,8 +306,6 @@ class InfBuildData(ModuleBuildClassObject):
                                         File=self.MetaFile, Line=Record[-1])\r
                     self._CustomMakefile[TokenList[0]] = TokenList[1]\r
             else:\r
-                if self._Defs is None:\r
-                    self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
                 self._Macros[Name] = Value\r
 \r
@@ -337,14 +334,14 @@ class InfBuildData(ModuleBuildClassObject):
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)\r
                 if self._ModuleType == SUP_MODULE_MM_STANDALONE:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)\r
-            if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
+            if 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
                and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:\r
                 self._BuildType = 'UEFI_OPTIONROM'\r
                 if 'PCI_COMPRESS' in self._Defs:\r
                     if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):\r
                         EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self.MetaFile)\r
 \r
-            elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
+            elif 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
                and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
                 self._BuildType = 'UEFI_HII'\r
             else:\r
@@ -398,7 +395,7 @@ class InfBuildData(ModuleBuildClassObject):
 #                                       File=self.MetaFile, Line=LineNo)\r
                     else:\r
                         if self._BuildOptions is None:\r
-                            self._BuildOptions = sdict()\r
+                            self._BuildOptions = OrderedDict()\r
 \r
                         if ToolList[0] in self._TOOL_CODE_:\r
                             Tool = self._TOOL_CODE_[ToolList[0]]\r
@@ -590,11 +587,8 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve definies other than above ones\r
     def _GetDefines(self):\r
-        if self._Defs is None:\r
-            if self._Header_ is None:\r
-                self._GetHeaderInfo()\r
-            if self._Defs is None:\r
-                self._Defs = sdict()\r
+        if len(self._Defs) == 0 and self._Header_ is None:\r
+            self._GetHeaderInfo()\r
         return self._Defs\r
 \r
     ## Retrieve binary files\r
@@ -688,7 +682,7 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve library classes employed by this module\r
     def _GetLibraryClassUses(self):\r
         if self._LibraryClasses is None:\r
-            self._LibraryClasses = sdict()\r
+            self._LibraryClasses = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 Lib = Record[0]\r
@@ -717,8 +711,8 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve protocols consumed/produced by this module\r
     def _GetProtocols(self):\r
         if self._Protocols is None:\r
-            self._Protocols = sdict()\r
-            self._ProtocolComments = sdict()\r
+            self._Protocols = OrderedDict()\r
+            self._ProtocolComments = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
@@ -742,8 +736,8 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve PPIs consumed/produced by this module\r
     def _GetPpis(self):\r
         if self._Ppis is None:\r
-            self._Ppis = sdict()\r
-            self._PpiComments = sdict()\r
+            self._Ppis = OrderedDict()\r
+            self._PpiComments = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
@@ -767,8 +761,8 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve GUIDs consumed/produced by this module\r
     def _GetGuids(self):\r
         if self._Guids is None:\r
-            self._Guids = sdict()\r
-            self._GuidComments = sdict()\r
+            self._Guids = OrderedDict()\r
+            self._GuidComments = OrderedDict()\r
             RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
@@ -869,8 +863,8 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve PCDs used in this module\r
     def _GetPcds(self):\r
         if self._Pcds is None:\r
-            self._Pcds = sdict()\r
-            self._PcdComments = sdict()\r
+            self._Pcds = OrderedDict()\r
+            self._PcdComments = 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
@@ -881,7 +875,7 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve build options specific to this module\r
     def _GetBuildOptions(self):\r
         if self._BuildOptions is None:\r
-            self._BuildOptions = sdict()\r
+            self._BuildOptions = OrderedDict()\r
             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 ToolChainFamily = Record[0]\r
@@ -920,7 +914,7 @@ class InfBuildData(ModuleBuildClassObject):
                                         "'%s' module must specify the type of [Depex] section" % self.ModuleType,\r
                                         File=self.MetaFile)\r
 \r
-            Depex = sdict()\r
+            Depex = OrderedDict()\r
             for Record in RecordList:\r
                 DepexStr = ReplaceMacro(Record[0], self._Macros, False)\r
                 Arch = Record[3]\r
@@ -961,7 +955,7 @@ class InfBuildData(ModuleBuildClassObject):
         if self._DepexExpression is None:\r
             self._DepexExpression = tdict(False, 2)\r
             RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]\r
-            DepexExpression = sdict()\r
+            DepexExpression = OrderedDict()\r
             for Record in RecordList:\r
                 DepexStr = ReplaceMacro(Record[0], self._Macros, False)\r
                 Arch = Record[3]\r
@@ -979,7 +973,7 @@ class InfBuildData(ModuleBuildClassObject):
         return self._GuidsUsedByPcd\r
     ## Retrieve PCD for given type\r
     def _GetPcd(self, Type):\r
-        Pcds = sdict()\r
+        Pcds = OrderedDict()\r
         PcdDict = tdict(True, 4)\r
         PcdList = []\r
         RecordList = self._RawData[Type, self._Arch, self._Platform]\r
index 8c27b4ad5b9b4ed9ec970973b4bb56ca66cf16ba..17ac3b10543177669da4dc5505deb269e317e78e 100644 (file)
@@ -11,7 +11,6 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 #\r
 \r
-from Common.Misc import sdict\r
 from collections import OrderedDict, defaultdict\r
 from Common.DataType import SUP_MODULE_USER_DEFINED\r
 from BuildClassObject import LibraryClassObject\r
@@ -113,7 +112,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
     LibraryConsumerList = [Module]\r
     Constructor = []\r
     ConsumedByList = OrderedListDict()\r
-    LibraryInstance = sdict()\r
+    LibraryInstance = OrderedDict()\r
 \r
     while len(LibraryConsumerList) > 0:\r
         M = LibraryConsumerList.pop()\r