public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/3] BaseTools: Modify class OrderedListDict
@ 2018-08-08  6:55 Feng, YunhuaX
  0 siblings, 0 replies; only message in thread
From: Feng, YunhuaX @ 2018-08-08  6:55 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Zhu, Yonghong, Gao, Liming

class OrderedListDict(OrderedDict, defaultdict) will
encounter multiple bases have instance lay-out
conflict error on python3

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index d987bbf441..8d8a3e2789 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -19,15 +19,19 @@ import Common.GlobalData as GlobalData
 from Workspace.BuildClassObject import StructurePcd
 from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
 from Common.BuildToolError import OPTION_MISSING
 from Common.BuildToolError import BUILD_ERROR
 
-class OrderedListDict(OrderedDict, defaultdict):
+class OrderedListDict(OrderedDict):
     def __init__(self, *args, **kwargs):
         super(OrderedListDict, self).__init__(*args, **kwargs)
         self.default_factory = list
 
+    def __missing__(self, key):
+        self[key] = Value = self.default_factory()
+        return Value
+
 ## Get all packages from platform for specified arch, target and toolchain
 #
 #  @param Platform: DscBuildData instance
 #  @param BuildDatabase: The database saves all data for all metafiles
 #  @param Arch: Current arch
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-08  6:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08  6:55 [PATCH 1/3] BaseTools: Modify class OrderedListDict Feng, YunhuaX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox