From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 05/10] BaseTools - AutoGen - replace custom dictionary class with python standard one
Date: Tue, 3 Apr 2018 14:03:05 -0700 [thread overview]
Message-ID: <dbc5eef1bf5570984169da4ffbdb604fd285fbc6.1522789210.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1522789210.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1522789210.git.jaben.carsey@intel.com>
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>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 31 ++++++++++----------
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 3384fdb70b7e..3865827f26df 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 dcdfcca1a5b0..533fdb54231c 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"]
--
2.16.2.windows.1
next prev parent reply other threads:[~2018-04-03 21:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 21:03 [PATCH v1 00/10] BaseTools: refactor code Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 01/10] BaseTools: Use local variable for list of constants Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 02/10] BaseTools: use built in dict instead of custom version Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 03/10] BaseTools: Eot tool never populates this dictionary Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 04/10] BaseTools: remove unused import statement Jaben Carsey
2018-04-03 21:03 ` Jaben Carsey [this message]
2018-04-03 21:03 ` [PATCH v1 06/10] BaseTools: Eot remove unused code Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 07/10] BaseTools: use built in OrderedDict instead of custom version Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 08/10] BaseTools: use combined version of OrderedDict Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 09/10] BaseTools: Workspace - use built in OrderedDict instead of custom version Jaben Carsey
2018-04-03 21:03 ` [PATCH v1 10/10] BaseTools: Remove unused code from Misc Jaben Carsey
2018-04-08 6:40 ` [PATCH v1 00/10] BaseTools: refactor code Zhu, Yonghong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbc5eef1bf5570984169da4ffbdb604fd285fbc6.1522789210.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox