BaseTools: do the list and iterator translation

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: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yunhua Feng 2018-07-27 13:14:59 +08:00 committed by Yonghong Zhu
parent 86e6cf98a8
commit 00fcce9153
12 changed files with 58 additions and 58 deletions

View File

@ -518,7 +518,7 @@ class WorkspaceAutoGen(AutoGen):
for BuildData in PGen.BuildDatabase._CACHE_.values(): for BuildData in PGen.BuildDatabase._CACHE_.values():
if BuildData.Arch != Arch: if BuildData.Arch != Arch:
continue continue
for key in BuildData.Pcds: for key in list(BuildData.Pcds.keys()):
for SinglePcd in GlobalData.MixedPcd: for SinglePcd in GlobalData.MixedPcd:
if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) == SinglePcd: if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) == SinglePcd:
for item in GlobalData.MixedPcd[SinglePcd]: for item in GlobalData.MixedPcd[SinglePcd]:
@ -864,7 +864,7 @@ class WorkspaceAutoGen(AutoGen):
def _CheckAllPcdsTokenValueConflict(self): def _CheckAllPcdsTokenValueConflict(self):
for Pa in self.AutoGenObjectList: for Pa in self.AutoGenObjectList:
for Package in Pa.PackageList: for Package in Pa.PackageList:
PcdList = Package.Pcds.values() PcdList = list(Package.Pcds.values())
PcdList.sort(key=lambda x: int(x.TokenValue, 0)) PcdList.sort(key=lambda x: int(x.TokenValue, 0))
Count = 0 Count = 0
while (Count < len(PcdList) - 1) : while (Count < len(PcdList) - 1) :
@ -910,7 +910,7 @@ class WorkspaceAutoGen(AutoGen):
Count += SameTokenValuePcdListCount Count += SameTokenValuePcdListCount
Count += 1 Count += 1
PcdList = Package.Pcds.values() PcdList = list(Package.Pcds.values())
PcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName)) PcdList.sort(key=lambda x: "%s.%s" % (x.TokenSpaceGuidCName, x.TokenCName))
Count = 0 Count = 0
while (Count < len(PcdList) - 1) : while (Count < len(PcdList) - 1) :
@ -1179,7 +1179,7 @@ class PlatformAutoGen(AutoGen):
if os.path.exists(VpdMapFilePath): if os.path.exists(VpdMapFilePath):
OrgVpdFile.Read(VpdMapFilePath) OrgVpdFile.Read(VpdMapFilePath)
PcdItems = OrgVpdFile.GetOffset(PcdNvStoreDfBuffer[0]) PcdItems = OrgVpdFile.GetOffset(PcdNvStoreDfBuffer[0])
NvStoreOffset = PcdItems.values()[0].strip() if PcdItems else '0' NvStoreOffset = list(PcdItems.values())[0].strip() if PcdItems else '0'
else: else:
EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath) EdkLogger.error("build", FILE_READ_FAILURE, "Can not find VPD map file %s to fix up VPD offset." % VpdMapFilePath)
@ -1229,7 +1229,7 @@ class PlatformAutoGen(AutoGen):
FdfModuleList.append(os.path.normpath(InfName)) FdfModuleList.append(os.path.normpath(InfName))
for M in self._MaList: for M in self._MaList:
# F is the Module for which M is the module autogen # F is the Module for which M is the module autogen
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList: for PcdFromModule in list(M.ModulePcdList) + list(M.LibraryPcdList):
# make sure that the "VOID*" kind of datum has MaxDatumSize set # make sure that the "VOID*" kind of datum has MaxDatumSize set
if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize: if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, M.MetaFile)) NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, M.MetaFile))
@ -1378,7 +1378,7 @@ class PlatformAutoGen(AutoGen):
if (self.Workspace.ArchList[-1] == self.Arch): if (self.Workspace.ArchList[-1] == self.Arch):
for Pcd in self._DynamicPcdList: for Pcd in self._DynamicPcdList:
# just pick the a value to determine whether is unicode string type # just pick the a value to determine whether is unicode string type
Sku = Pcd.SkuInfoList.values()[0] Sku = list(Pcd.SkuInfoList.values())[0]
Sku.VpdOffset = Sku.VpdOffset.strip() Sku.VpdOffset = Sku.VpdOffset.strip()
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]: if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
@ -1477,7 +1477,7 @@ class PlatformAutoGen(AutoGen):
if not FoundFlag : if not FoundFlag :
# just pick the a value to determine whether is unicode string type # just pick the a value to determine whether is unicode string type
SkuValueMap = {} SkuValueMap = {}
SkuObjList = DscPcdEntry.SkuInfoList.items() SkuObjList = list(DscPcdEntry.SkuInfoList.items())
DefaultSku = DscPcdEntry.SkuInfoList.get(TAB_DEFAULT) DefaultSku = DscPcdEntry.SkuInfoList.get(TAB_DEFAULT)
if DefaultSku: if DefaultSku:
defaultindex = SkuObjList.index((TAB_DEFAULT, DefaultSku)) defaultindex = SkuObjList.index((TAB_DEFAULT, DefaultSku))
@ -1503,7 +1503,7 @@ class PlatformAutoGen(AutoGen):
DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName] DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName]
# Only fix the value while no value provided in DSC file. # Only fix the value while no value provided in DSC file.
if not Sku.DefaultValue: if not Sku.DefaultValue:
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue DscPcdEntry.SkuInfoList[list(DscPcdEntry.SkuInfoList.keys())[0]].DefaultValue = DecPcdEntry.DefaultValue
if DscPcdEntry not in self._DynamicPcdList: if DscPcdEntry not in self._DynamicPcdList:
self._DynamicPcdList.append(DscPcdEntry) self._DynamicPcdList.append(DscPcdEntry)
@ -1579,7 +1579,7 @@ class PlatformAutoGen(AutoGen):
# Delete the DynamicPcdList At the last time enter into this function # Delete the DynamicPcdList At the last time enter into this function
for Pcd in self._DynamicPcdList: for Pcd in self._DynamicPcdList:
# just pick the a value to determine whether is unicode string type # just pick the a value to determine whether is unicode string type
Sku = Pcd.SkuInfoList.values()[0] Sku = list(Pcd.SkuInfoList.values())[0]
Sku.VpdOffset = Sku.VpdOffset.strip() Sku.VpdOffset = Sku.VpdOffset.strip()
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]: if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
@ -2144,7 +2144,7 @@ class PlatformAutoGen(AutoGen):
Pcd.MaxDatumSize = str(len(Value.split(','))) Pcd.MaxDatumSize = str(len(Value.split(',')))
else: else:
Pcd.MaxDatumSize = str(len(Value) - 1) Pcd.MaxDatumSize = str(len(Value) - 1)
return Pcds.values() return list(Pcds.values())
## Resolve library names to library modules ## Resolve library names to library modules
# #
@ -2248,7 +2248,7 @@ class PlatformAutoGen(AutoGen):
# Use the highest priority value. # Use the highest priority value.
# #
if (len(OverrideList) >= 2): if (len(OverrideList) >= 2):
KeyList = OverrideList.keys() KeyList = list(OverrideList.keys())
for Index in range(len(KeyList)): for Index in range(len(KeyList)):
NowKey = KeyList[Index] NowKey = KeyList[Index]
Target1, ToolChain1, Arch1, CommandType1, Attr1 = NowKey.split("_") Target1, ToolChain1, Arch1, CommandType1, Attr1 = NowKey.split("_")
@ -2370,9 +2370,9 @@ class PlatformAutoGen(AutoGen):
if Attr == TAB_TOD_DEFINES_BUILDRULEORDER: if Attr == TAB_TOD_DEFINES_BUILDRULEORDER:
BuildRuleOrder = Options[Tool][Attr] BuildRuleOrder = Options[Tool][Attr]
AllTools = set(ModuleOptions.keys() + PlatformOptions.keys() + AllTools = set(list(ModuleOptions.keys()) + list(PlatformOptions.keys()) +
PlatformModuleOptions.keys() + ModuleTypeOptions.keys() + list(PlatformModuleOptions.keys()) + list(ModuleTypeOptions.keys()) +
self.ToolDefinition.keys()) list(self.ToolDefinition.keys()))
BuildOptions = defaultdict(lambda: defaultdict(str)) BuildOptions = defaultdict(lambda: defaultdict(str))
for Tool in AllTools: for Tool in AllTools:
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]: for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
@ -3436,7 +3436,7 @@ class ModuleAutoGen(AutoGen):
return None return None
MapFileName = os.path.join(self.OutputDir, self.Name + ".map") MapFileName = os.path.join(self.OutputDir, self.Name + ".map")
EfiFileName = os.path.join(self.OutputDir, self.Name + ".efi") EfiFileName = os.path.join(self.OutputDir, self.Name + ".efi")
VfrUniOffsetList = GetVariableOffset(MapFileName, EfiFileName, VfrUniBaseName.values()) VfrUniOffsetList = GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))
if not VfrUniOffsetList: if not VfrUniOffsetList:
return None return None
@ -3521,7 +3521,7 @@ class ModuleAutoGen(AutoGen):
Packages = [] Packages = []
PcdCheckList = [] PcdCheckList = []
PcdTokenSpaceList = [] PcdTokenSpaceList = []
for Pcd in self.ModulePcdList + self.LibraryPcdList: for Pcd in list(self.ModulePcdList) + list(self.LibraryPcdList):
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
PatchablePcds.append(Pcd) PatchablePcds.append(Pcd)
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE)) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE))

View File

@ -936,7 +936,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
if Info.IsLibrary: if Info.IsLibrary:
PcdList = Info.LibraryPcdList PcdList = Info.LibraryPcdList
else: else:
PcdList = Info.ModulePcdList + Info.LibraryPcdList PcdList = list(Info.ModulePcdList) + list(Info.LibraryPcdList)
PcdExCNameTest = 0 PcdExCNameTest = 0
for PcdModule in PcdList: for PcdModule in PcdList:
if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName: if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:
@ -970,7 +970,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName)) AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s, (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
elif Pcd.Type in PCD_DYNAMIC_TYPE_SET: elif Pcd.Type in PCD_DYNAMIC_TYPE_SET:
PcdCNameTest = 0 PcdCNameTest = 0
for PcdModule in Info.LibraryPcdList + Info.ModulePcdList: for PcdModule in list(Info.LibraryPcdList) + list(Info.ModulePcdList):
if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName: if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:
PcdCNameTest += 1 PcdCNameTest += 1
# get out early once we found > 1... # get out early once we found > 1...
@ -2065,7 +2065,7 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer,
if Guid in Info.Module.GetGuidsUsedByPcd(): if Guid in Info.Module.GetGuidsUsedByPcd():
continue continue
GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid])) GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid]))
for Guid, Value in Info.Module.Protocols.items() + Info.Module.Ppis.items(): for Guid, Value in list(Info.Module.Protocols.items()) + list(Info.Module.Ppis.items()):
GuidMacros.append('#define %s %s' % (Guid, Value)) GuidMacros.append('#define %s %s' % (Guid, Value))
# supports FixedAtBuild and FeaturePcd usage in VFR file # supports FixedAtBuild and FeaturePcd usage in VFR file
if Info.VfrFileList and Info.ModulePcdList: if Info.VfrFileList and Info.ModulePcdList:

View File

@ -668,8 +668,8 @@ cleanlib:
"separator" : Separator, "separator" : Separator,
"module_tool_definitions" : ToolsDef, "module_tool_definitions" : ToolsDef,
"shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), "shell_command_code" : list(self._SHELL_CMD_[self._FileType].keys()),
"shell_command" : self._SHELL_CMD_[self._FileType].values(), "shell_command" : list(self._SHELL_CMD_[self._FileType].values()),
"module_entry_point" : ModuleEntryPoint, "module_entry_point" : ModuleEntryPoint,
"image_entry_point" : ImageEntryPoint, "image_entry_point" : ImageEntryPoint,
@ -1274,8 +1274,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
"separator" : Separator, "separator" : Separator,
"module_tool_definitions" : ToolsDef, "module_tool_definitions" : ToolsDef,
"shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), "shell_command_code" : list(self._SHELL_CMD_[self._FileType].keys()),
"shell_command" : self._SHELL_CMD_[self._FileType].values(), "shell_command" : list(self._SHELL_CMD_[self._FileType].values()),
"create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList), "create_directory_command" : self.GetCreateDirectoryCommand(self.IntermediateDirectoryList),
"custom_makefile_content" : CustomMakefile "custom_makefile_content" : CustomMakefile
@ -1448,8 +1448,8 @@ cleanlib:
"toolchain_tag" : MyAgo.ToolChain, "toolchain_tag" : MyAgo.ToolChain,
"build_target" : MyAgo.BuildTarget, "build_target" : MyAgo.BuildTarget,
"shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), "shell_command_code" : list(self._SHELL_CMD_[self._FileType].keys()),
"shell_command" : self._SHELL_CMD_[self._FileType].values(), "shell_command" : list(self._SHELL_CMD_[self._FileType].values()),
"build_architecture_list" : MyAgo.Arch, "build_architecture_list" : MyAgo.Arch,
"architecture" : MyAgo.Arch, "architecture" : MyAgo.Arch,
"separator" : Separator, "separator" : Separator,
@ -1584,8 +1584,8 @@ class TopLevelMakefile(BuildFile):
"toolchain_tag" : MyAgo.ToolChain, "toolchain_tag" : MyAgo.ToolChain,
"build_target" : MyAgo.BuildTarget, "build_target" : MyAgo.BuildTarget,
"shell_command_code" : self._SHELL_CMD_[self._FileType].keys(), "shell_command_code" : list(self._SHELL_CMD_[self._FileType].keys()),
"shell_command" : self._SHELL_CMD_[self._FileType].values(), "shell_command" : list(self._SHELL_CMD_[self._FileType].values()),
'arch' : list(MyAgo.ArchList), 'arch' : list(MyAgo.ArchList),
"build_architecture_list" : ','.join(MyAgo.ArchList), "build_architecture_list" : ','.join(MyAgo.ArchList),
"separator" : Separator, "separator" : Separator,

View File

@ -611,7 +611,7 @@ def BuildExDataBase(Dict):
DbVardefValueUint32 = DbItemList(4, RawDataList = VardefValueUint32) DbVardefValueUint32 = DbItemList(4, RawDataList = VardefValueUint32)
VpdHeadValue = Dict['VPD_DB_VALUE'] VpdHeadValue = Dict['VPD_DB_VALUE']
DbVpdHeadValue = DbComItemList(4, RawDataList = VpdHeadValue) DbVpdHeadValue = DbComItemList(4, RawDataList = VpdHeadValue)
ExMapTable = zip(Dict['EXMAPPING_TABLE_EXTOKEN'], Dict['EXMAPPING_TABLE_LOCAL_TOKEN'], Dict['EXMAPPING_TABLE_GUID_INDEX']) ExMapTable = list(zip(Dict['EXMAPPING_TABLE_EXTOKEN'], Dict['EXMAPPING_TABLE_LOCAL_TOKEN'], Dict['EXMAPPING_TABLE_GUID_INDEX']))
DbExMapTable = DbExMapTblItemList(8, RawDataList = ExMapTable) DbExMapTable = DbExMapTblItemList(8, RawDataList = ExMapTable)
LocalTokenNumberTable = Dict['LOCAL_TOKEN_NUMBER_DB_VALUE'] LocalTokenNumberTable = Dict['LOCAL_TOKEN_NUMBER_DB_VALUE']
DbLocalTokenNumberTable = DbItemList(4, RawDataList = LocalTokenNumberTable) DbLocalTokenNumberTable = DbItemList(4, RawDataList = LocalTokenNumberTable)
@ -645,7 +645,7 @@ def BuildExDataBase(Dict):
PcdNameOffsetTable = Dict['PCD_NAME_OFFSET'] PcdNameOffsetTable = Dict['PCD_NAME_OFFSET']
DbPcdNameOffsetTable = DbItemList(4, RawDataList = PcdNameOffsetTable) DbPcdNameOffsetTable = DbItemList(4, RawDataList = PcdNameOffsetTable)
SizeTableValue = zip(Dict['SIZE_TABLE_MAXIMUM_LENGTH'], Dict['SIZE_TABLE_CURRENT_LENGTH']) SizeTableValue = list(zip(Dict['SIZE_TABLE_MAXIMUM_LENGTH'], Dict['SIZE_TABLE_CURRENT_LENGTH']))
DbSizeTableValue = DbSizeTableItemList(2, RawDataList = SizeTableValue) DbSizeTableValue = DbSizeTableItemList(2, RawDataList = SizeTableValue)
InitValueUint16 = Dict['INIT_DB_VALUE_UINT16'] InitValueUint16 = Dict['INIT_DB_VALUE_UINT16']
DbInitValueUint16 = DbComItemList(2, RawDataList = InitValueUint16) DbInitValueUint16 = DbComItemList(2, RawDataList = InitValueUint16)

View File

@ -552,9 +552,9 @@ def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, Ski
# #
# support ISO 639-2 codes in .UNI files of EDK Shell # support ISO 639-2 codes in .UNI files of EDK Shell
# #
Uni = UniFileClassObject(sorted (UniFilList), True, IncludePathList) Uni = UniFileClassObject(sorted (UniFilList, key=lambda x: x.File), True, IncludePathList)
else: else:
Uni = UniFileClassObject(sorted (UniFilList), IsCompatibleMode, IncludePathList) Uni = UniFileClassObject(sorted (UniFilList, key=lambda x: x.File), IsCompatibleMode, IncludePathList)
else: else:
EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, 'No unicode files given') EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, 'No unicode files given')

View File

@ -24,8 +24,8 @@ import pickle
import array import array
import shutil import shutil
from struct import pack from struct import pack
from UserDict import IterableUserDict from collections import UserDict as IterableUserDict
from UserList import UserList from collections import OrderedDict
from Common import EdkLogger as EdkLogger from Common import EdkLogger as EdkLogger
from Common import GlobalData as GlobalData from Common import GlobalData as GlobalData
@ -654,7 +654,7 @@ def RealPath2(File, Dir='', OverrideDir=''):
# #
def GuidValue(CName, PackageList, Inffile = None): def GuidValue(CName, PackageList, Inffile = None):
for P in PackageList: for P in PackageList:
GuidKeys = P.Guids.keys() GuidKeys = list(P.Guids.keys())
if Inffile and P._PrivateGuids: if Inffile and P._PrivateGuids:
if not Inffile.startswith(P.MetaFile.Dir): if not Inffile.startswith(P.MetaFile.Dir):
GuidKeys = [x for x in P.Guids if x not in P._PrivateGuids] GuidKeys = [x for x in P.Guids if x not in P._PrivateGuids]
@ -673,7 +673,7 @@ def GuidValue(CName, PackageList, Inffile = None):
# #
def ProtocolValue(CName, PackageList, Inffile = None): def ProtocolValue(CName, PackageList, Inffile = None):
for P in PackageList: for P in PackageList:
ProtocolKeys = P.Protocols.keys() ProtocolKeys = list(P.Protocols.keys())
if Inffile and P._PrivateProtocols: if Inffile and P._PrivateProtocols:
if not Inffile.startswith(P.MetaFile.Dir): if not Inffile.startswith(P.MetaFile.Dir):
ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols] ProtocolKeys = [x for x in P.Protocols if x not in P._PrivateProtocols]
@ -692,7 +692,7 @@ def ProtocolValue(CName, PackageList, Inffile = None):
# #
def PpiValue(CName, PackageList, Inffile = None): def PpiValue(CName, PackageList, Inffile = None):
for P in PackageList: for P in PackageList:
PpiKeys = P.Ppis.keys() PpiKeys = list(P.Ppis.keys())
if Inffile and P._PrivatePpis: if Inffile and P._PrivatePpis:
if not Inffile.startswith(P.MetaFile.Dir): if not Inffile.startswith(P.MetaFile.Dir):
PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis] PpiKeys = [x for x in P.Ppis if x not in P._PrivatePpis]
@ -1960,7 +1960,7 @@ class SkuClass():
ExtraData = "SKU-ID [%s] value %s exceeds the max value of UINT64" ExtraData = "SKU-ID [%s] value %s exceeds the max value of UINT64"
% (SkuName, SkuId)) % (SkuName, SkuId))
self.AvailableSkuIds = sdict() self.AvailableSkuIds = OrderedDict()
self.SkuIdSet = [] self.SkuIdSet = []
self.SkuIdNumberSet = [] self.SkuIdNumberSet = []
self.SkuData = SkuIds self.SkuData = SkuIds
@ -1970,7 +1970,7 @@ class SkuClass():
self.SkuIdSet = ['DEFAULT'] self.SkuIdSet = ['DEFAULT']
self.SkuIdNumberSet = ['0U'] self.SkuIdNumberSet = ['0U']
elif SkuIdentifier == 'ALL': elif SkuIdentifier == 'ALL':
self.SkuIdSet = SkuIds.keys() self.SkuIdSet = list(SkuIds.keys())
self.SkuIdNumberSet = [num[0].strip() + 'U' for num in SkuIds.values()] self.SkuIdNumberSet = [num[0].strip() + 'U' for num in SkuIds.values()]
else: else:
r = SkuIdentifier.split('|') r = SkuIdentifier.split('|')

View File

@ -98,7 +98,7 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
# @retval list() A list for splitted string # @retval list() A list for splitted string
# #
def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1): def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)) return list(map(lambda l: l.strip(), String.split(SplitStr, MaxSplit)))
## MergeArches ## MergeArches
# #
@ -544,7 +544,7 @@ def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCh
# #
LineList[1] = CleanString(LineList[1], CommentCharacter) LineList[1] = CleanString(LineList[1], CommentCharacter)
if ValueSplitFlag: if ValueSplitFlag:
Value = map(string.strip, LineList[1].split(ValueSplitCharacter)) Value = list(map(string.strip, LineList[1].split(ValueSplitCharacter)))
else: else:
Value = CleanString(LineList[1], CommentCharacter).splitlines() Value = CleanString(LineList[1], CommentCharacter).splitlines()
@ -750,7 +750,7 @@ def SplitString(String):
# @param StringList: A list for strings to be converted # @param StringList: A list for strings to be converted
# #
def ConvertToSqlString(StringList): def ConvertToSqlString(StringList):
return map(lambda s: s.replace("'", "''"), StringList) return list(map(lambda s: s.replace("'", "''"), StringList))
## Convert To Sql String ## Convert To Sql String
# #

View File

@ -1073,7 +1073,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName): def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName):
MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map") MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map")
EfiFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".efi") EfiFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".efi")
return GetVariableOffset(MapFileName, EfiFileName, VfrUniBaseName.values()) return GetVariableOffset(MapFileName, EfiFileName, list(VfrUniBaseName.values()))
## __GenUniVfrOffsetFile() method ## __GenUniVfrOffsetFile() method
# #

View File

@ -1551,7 +1551,7 @@ class DscBuildData(PlatformBuildClassObject):
elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList: elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
del pcd.SkuInfoList[TAB_COMMON] del pcd.SkuInfoList[TAB_COMMON]
map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType]) list(map(self.FilterSkuSettings, [Pcds[pcdkey] for pcdkey in Pcds if Pcds[pcdkey].Type in DynamicPcdType]))
return Pcds return Pcds
## Retrieve non-dynamic PCD settings ## Retrieve non-dynamic PCD settings
@ -2505,7 +2505,7 @@ class DscBuildData(PlatformBuildClassObject):
elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList: elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuInfoList:
del pcd.SkuInfoList[TAB_COMMON] del pcd.SkuInfoList[TAB_COMMON]
map(self.FilterSkuSettings, Pcds.values()) list(map(self.FilterSkuSettings, Pcds.values()))
return Pcds return Pcds
@ -2570,7 +2570,7 @@ class DscBuildData(PlatformBuildClassObject):
PcdObj.SkuInfoList[skuname].SkuId = skuid PcdObj.SkuInfoList[skuname].SkuId = skuid
PcdObj.SkuInfoList[skuname].SkuIdName = skuname PcdObj.SkuInfoList[skuname].SkuIdName = skuname
if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
PcdObj.DefaultValue = PcdObj.SkuInfoList.values()[0].HiiDefaultValue if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE else PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue PcdObj.DefaultValue = list(PcdObj.SkuInfoList.values())[0].HiiDefaultValue if self.SkuIdMgr.SkuUsageType == self.SkuIdMgr.SINGLE else PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue
Pcds[PcdCName, TokenSpaceGuid]= PcdObj Pcds[PcdCName, TokenSpaceGuid]= PcdObj
return Pcds return Pcds
## Retrieve dynamic HII PCD settings ## Retrieve dynamic HII PCD settings
@ -2731,7 +2731,7 @@ class DscBuildData(PlatformBuildClassObject):
invalidpcd = ",".join(invalidhii) invalidpcd = ",".join(invalidhii)
EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd) EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd)
map(self.FilterSkuSettings, Pcds.values()) list(map(self.FilterSkuSettings, Pcds.values()))
return Pcds return Pcds
@ -2829,7 +2829,7 @@ class DscBuildData(PlatformBuildClassObject):
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {} Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = InitialValue Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = InitialValue
for pcd in Pcds.values(): for pcd in Pcds.values():
SkuInfoObj = pcd.SkuInfoList.values()[0] SkuInfoObj = list(pcd.SkuInfoList.values())[0]
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName] pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
pcd.DatumType = pcdDecObject.DatumType pcd.DatumType = pcdDecObject.DatumType
# Only fix the value while no value provided in DSC file. # Only fix the value while no value provided in DSC file.
@ -2847,7 +2847,7 @@ class DscBuildData(PlatformBuildClassObject):
del pcd.SkuInfoList[TAB_COMMON] del pcd.SkuInfoList[TAB_COMMON]
map(self.FilterSkuSettings, Pcds.values()) list(map(self.FilterSkuSettings, Pcds.values()))
return Pcds return Pcds
## Add external modules ## Add external modules

View File

@ -22,7 +22,7 @@ from CommonDataClass.DataClass import FileClass
## Convert to SQL required string format ## Convert to SQL required string format
def ConvertToSqlString(StringList): def ConvertToSqlString(StringList):
return map(lambda s: "'" + s.replace("'", "''") + "'", StringList) return list(map(lambda s: "'" + s.replace("'", "''") + "'", StringList))
## TableFile ## TableFile
# #

View File

@ -600,7 +600,7 @@ class ModuleReport(object):
# Collect all module used PCD set: module INF referenced directly or indirectly. # Collect all module used PCD set: module INF referenced directly or indirectly.
# It also saves module INF default values of them in case they exist. # It also saves module INF default values of them in case they exist.
# #
for Pcd in M.ModulePcdList + M.LibraryPcdList: for Pcd in list(M.ModulePcdList) + list(M.LibraryPcdList):
self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue)) self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue))
self.LibraryReport = None self.LibraryReport = None
@ -853,7 +853,7 @@ class PcdReport(object):
# #
# Collect module override PCDs # Collect module override PCDs
# #
for ModulePcd in Module.M.ModulePcdList + Module.M.LibraryPcdList: for ModulePcd in list(Module.M.ModulePcdList) + list(Module.M.LibraryPcdList):
TokenCName = ModulePcd.TokenCName TokenCName = ModulePcd.TokenCName
TokenSpaceGuid = ModulePcd.TokenSpaceGuidCName TokenSpaceGuid = ModulePcd.TokenSpaceGuidCName
ModuleDefault = ModulePcd.DefaultValue ModuleDefault = ModulePcd.DefaultValue
@ -1082,9 +1082,9 @@ class PcdReport(object):
if not Pcd.SkuInfoList: if not Pcd.SkuInfoList:
OverrideValues = Pcd.SkuOverrideValues OverrideValues = Pcd.SkuOverrideValues
if OverrideValues: if OverrideValues:
Keys = OverrideValues.keys() Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]] Data = OverrideValues[Keys[0]]
Struct = Data.values()[0] Struct = list(Data.values())[0]
DscOverride = self.ParseStruct(Struct) DscOverride = self.ParseStruct(Struct)
else: else:
SkuList = sorted(Pcd.SkuInfoList.keys()) SkuList = sorted(Pcd.SkuInfoList.keys())
@ -1101,7 +1101,7 @@ class PcdReport(object):
else: else:
OverrideValues = Pcd.SkuOverrideValues[Sku] OverrideValues = Pcd.SkuOverrideValues[Sku]
if OverrideValues: if OverrideValues:
Keys = OverrideValues.keys() Keys = list(OverrideValues.keys())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
DscOverride = self.ParseStruct(OverrideFieldStruct) DscOverride = self.ParseStruct(OverrideFieldStruct)
if DscOverride: if DscOverride:
@ -1256,9 +1256,9 @@ class PcdReport(object):
if IsStructure: if IsStructure:
OverrideValues = Pcd.SkuOverrideValues OverrideValues = Pcd.SkuOverrideValues
if OverrideValues: if OverrideValues:
Keys = OverrideValues.keys() Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]] Data = OverrideValues[Keys[0]]
Struct = Data.values()[0] Struct = list(Data.values())[0]
OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct) OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct)
self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintStructureInfo(File, OverrideFieldStruct)
self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
@ -1382,7 +1382,7 @@ class PcdReport(object):
if IsStructure: if IsStructure:
OverrideValues = Pcd.SkuOverrideValues[Sku] OverrideValues = Pcd.SkuOverrideValues[Sku]
if OverrideValues: if OverrideValues:
Keys = OverrideValues.keys() Keys = list(OverrideValues.keys())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintStructureInfo(File, OverrideFieldStruct)
self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)

View File

@ -503,7 +503,7 @@ class BuildTask:
# get all pending tasks # get all pending tasks
BuildTask._PendingQueueLock.acquire() BuildTask._PendingQueueLock.acquire()
BuildObjectList = BuildTask._PendingQueue.keys() BuildObjectList = list(BuildTask._PendingQueue.keys())
# #
# check if their dependency is resolved, and if true, move them # check if their dependency is resolved, and if true, move them
# into ready queue # into ready queue