BaseTools: Modify class OrderedListDict

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Feng, YunhuaX 2018-08-08 14:55:35 +08:00 committed by Yonghong Zhu
parent c1260801fd
commit abb8e6e97a
1 changed files with 5 additions and 1 deletions

View File

@ -21,11 +21,15 @@ from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
from Common.BuildToolError import OPTION_MISSING from Common.BuildToolError import OPTION_MISSING
from Common.BuildToolError import BUILD_ERROR from Common.BuildToolError import BUILD_ERROR
class OrderedListDict(OrderedDict, defaultdict): class OrderedListDict(OrderedDict):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(OrderedListDict, self).__init__(*args, **kwargs) super(OrderedListDict, self).__init__(*args, **kwargs)
self.default_factory = list 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 ## Get all packages from platform for specified arch, target and toolchain
# #
# @param Platform: DscBuildData instance # @param Platform: DscBuildData instance