BaseTools: the list and iterator translation
In python3,The keys of the dictionary not a list,It needs to be converted Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -574,13 +574,14 @@ def RealPath(File, Dir='', OverrideDir=''):
|
||||
#
|
||||
def GuidValue(CName, PackageList, Inffile = None):
|
||||
for P in PackageList:
|
||||
GuidKeys = P.Guids.keys()
|
||||
GuidKeys = list(P.Guids.keys())
|
||||
if Inffile and P._PrivateGuids:
|
||||
if not Inffile.startswith(P.MetaFile.Dir):
|
||||
GuidKeys = [x for x in P.Guids if x not in P._PrivateGuids]
|
||||
if CName in GuidKeys:
|
||||
return P.Guids[CName]
|
||||
return None
|
||||
return None
|
||||
|
||||
## A string template class
|
||||
#
|
||||
@ -1637,7 +1638,7 @@ class SkuClass():
|
||||
self.SkuIdSet = ['DEFAULT']
|
||||
self.SkuIdNumberSet = ['0U']
|
||||
elif SkuIdentifier == 'ALL':
|
||||
self.SkuIdSet = SkuIds.keys()
|
||||
self.SkuIdSet = list(SkuIds.keys())
|
||||
self.SkuIdNumberSet = [num[0].strip() + 'U' for num in SkuIds.values()]
|
||||
else:
|
||||
r = SkuIdentifier.split('|')
|
||||
|
@ -99,7 +99,7 @@ def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
|
||||
# @retval list() A list for splitted string
|
||||
#
|
||||
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
|
||||
#
|
||||
@ -545,7 +545,7 @@ def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCh
|
||||
#
|
||||
LineList[1] = CleanString(LineList[1], CommentCharacter)
|
||||
if ValueSplitFlag:
|
||||
Value = map(string.strip, LineList[1].split(ValueSplitCharacter))
|
||||
Value = list(map(string.strip, LineList[1].split(ValueSplitCharacter)))
|
||||
else:
|
||||
Value = CleanString(LineList[1], CommentCharacter).splitlines()
|
||||
|
||||
@ -751,7 +751,7 @@ def SplitString(String):
|
||||
# @param StringList: A list for strings to be converted
|
||||
#
|
||||
def ConvertToSqlString(StringList):
|
||||
return map(lambda s: s.replace("'", "''"), StringList)
|
||||
return list(map(lambda s: s.replace("'", "''"), StringList))
|
||||
|
||||
## Convert To Sql String
|
||||
#
|
||||
|
Reference in New Issue
Block a user