]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools - AutoGen - replace custom dictionary class with python standard one
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Tue, 3 Apr 2018 21:03:05 +0000 (05:03 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Sun, 8 Apr 2018 06:50:16 +0000 (14:50 +0800)
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>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenMake.py

index 3384fdb70b7ef2b1f292db5992e88ab6ba4a35fc..3865827f26df751814d3eda57f2636641b7ec082 100644 (file)
@@ -45,6 +45,7 @@ import InfSectionParser
 import datetime\r
 import hashlib\r
 from GenVar import VariableMgr,var_info\r
+from collections import OrderedDict\r
 \r
 ## Regular expression for splitting Dependency Expression string into tokens\r
 gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")\r
@@ -892,7 +893,7 @@ class WorkspaceAutoGen(AutoGen):
         ]\r
 \r
         # This dict store PCDs which are not used by any modules with specified arches\r
-        UnusedPcd = sdict()\r
+        UnusedPcd = OrderedDict()\r
         for Pa in self.AutoGenObjectList:\r
             # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid\r
             for Pcd in Pa.Platform.Pcds:\r
@@ -2084,7 +2085,7 @@ class PlatformAutoGen(AutoGen):
     ## Generate Token Number for all PCD\r
     def _GetPcdTokenNumbers(self):\r
         if self._PcdTokenNumber is None:\r
-            self._PcdTokenNumber = sdict()\r
+            self._PcdTokenNumber = OrderedDict()\r
             TokenNumber = 1\r
             #\r
             # Make the Dynamic and DynamicEx PCD use within different TokenNumber area. \r
@@ -2207,8 +2208,8 @@ class PlatformAutoGen(AutoGen):
         # 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), self.Arch))\r
@@ -2880,14 +2881,14 @@ class ModuleAutoGen(AutoGen):
         self._DerivedPackageList      = None\r
         self._ModulePcdList           = None\r
         self._LibraryPcdList          = None\r
-        self._PcdComments = sdict()\r
+        self._PcdComments = OrderedDict()\r
         self._GuidList                = None\r
         self._GuidsUsedByPcd = None\r
-        self._GuidComments = sdict()\r
+        self._GuidComments = OrderedDict()\r
         self._ProtocolList            = None\r
-        self._ProtocolComments = sdict()\r
+        self._ProtocolComments = OrderedDict()\r
         self._PpiList                 = None\r
-        self._PpiComments = sdict()\r
+        self._PpiComments = OrderedDict()\r
         self._DepexList               = None\r
         self._DepexExpressionList     = None\r
         self._BuildOption             = None\r
@@ -2943,7 +2944,7 @@ class ModuleAutoGen(AutoGen):
     # Macros could be used in build_rule.txt (also Makefile)\r
     def _GetMacros(self):\r
         if self._Macro is None:\r
-            self._Macro = sdict()\r
+            self._Macro = OrderedDict()\r
             self._Macro["WORKSPACE"             ] = self.WorkspaceDir\r
             self._Macro["MODULE_NAME"           ] = self.Name\r
             self._Macro["MODULE_NAME_GUID"      ] = self._GetUniqueBaseName()\r
@@ -3695,7 +3696,7 @@ class ModuleAutoGen(AutoGen):
     #\r
     def _GetLibraryPcdList(self):\r
         if self._LibraryPcdList is None:\r
-            Pcds = sdict()\r
+            Pcds = OrderedDict()\r
             if not self.IsLibrary:\r
                 # get PCDs from dependent libraries\r
                 for Library in self.DependentLibraryList:\r
@@ -3717,7 +3718,7 @@ class ModuleAutoGen(AutoGen):
     #\r
     def _GetGuidList(self):\r
         if self._GuidList is None:\r
-            self._GuidList = sdict()\r
+            self._GuidList = OrderedDict()\r
             self._GuidList.update(self.Module.Guids)\r
             for Library in self.DependentLibraryList:\r
                 self._GuidList.update(Library.Guids)\r
@@ -3727,7 +3728,7 @@ class ModuleAutoGen(AutoGen):
 \r
     def GetGuidsUsedByPcd(self):\r
         if self._GuidsUsedByPcd is None:\r
-            self._GuidsUsedByPcd = sdict()\r
+            self._GuidsUsedByPcd = OrderedDict()\r
             self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd())\r
             for Library in self.DependentLibraryList:\r
                 self._GuidsUsedByPcd.update(Library.GetGuidsUsedByPcd())\r
@@ -3738,7 +3739,7 @@ class ModuleAutoGen(AutoGen):
     #\r
     def _GetProtocolList(self):\r
         if self._ProtocolList is None:\r
-            self._ProtocolList = sdict()\r
+            self._ProtocolList = OrderedDict()\r
             self._ProtocolList.update(self.Module.Protocols)\r
             for Library in self.DependentLibraryList:\r
                 self._ProtocolList.update(Library.Protocols)\r
@@ -3752,7 +3753,7 @@ class ModuleAutoGen(AutoGen):
     #\r
     def _GetPpiList(self):\r
         if self._PpiList is None:\r
-            self._PpiList = sdict()\r
+            self._PpiList = OrderedDict()\r
             self._PpiList.update(self.Module.Ppis)\r
             for Library in self.DependentLibraryList:\r
                 self._PpiList.update(Library.Ppis)\r
@@ -3983,7 +3984,7 @@ class ModuleAutoGen(AutoGen):
                     PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx'))\r
                     PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic'))\r
                     PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName)\r
-        GuidList = sdict()\r
+        GuidList = OrderedDict()\r
         GuidList.update(self.GuidList)\r
         for TokenSpace in self.GetGuidsUsedByPcd():\r
             # If token space is not referred by patch PCD or Ex PCD, remove the GUID from GUID list\r
index dcdfcca1a5b066e453752781268083a99265c3d2..533fdb54231ce3ec0ed5bb2db389479962bdd900 100644 (file)
@@ -25,6 +25,7 @@ from Common.Misc import *
 from Common.String import *\r
 from BuildEngine import *\r
 import Common.GlobalData as GlobalData\r
+from collections import OrderedDict\r
 \r
 ## Regular expression for finding header file inclusions\r
 gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)\r
@@ -442,7 +443,7 @@ cleanlib:
         self.LibraryMakefileList = []\r
         self.LibraryBuildDirectoryList = []\r
         self.SystemLibraryList = []\r
-        self.Macros = sdict()\r
+        self.Macros = OrderedDict()\r
         self.Macros["OUTPUT_DIR"      ] = self._AutoGenObject.Macros["OUTPUT_DIR"]\r
         self.Macros["DEBUG_DIR"       ] = self._AutoGenObject.Macros["DEBUG_DIR"]\r
         self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"]\r