summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Common
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-07-27 13:14:59 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-10-13 09:54:52 +0800
commit00fcce91534e02f0e350c73b0c5472543f0de271 (patch)
tree5caed25154ef682550e64327eac60f34b60f42e1 /BaseTools/Source/Python/Common
parent86e6cf98a8493574878286522078050ac4dd505d (diff)
downloadedk2-00fcce91534e02f0e350c73b0c5472543f0de271.tar.gz
edk2-00fcce91534e02f0e350c73b0c5472543f0de271.tar.bz2
edk2-00fcce91534e02f0e350c73b0c5472543f0de271.zip
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>
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r--BaseTools/Source/Python/Common/Misc.py14
-rw-r--r--BaseTools/Source/Python/Common/StringUtils.py6
2 files changed, 10 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 2253b67af6..ea0e62245f 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -24,8 +24,8 @@ import pickle
import array
import shutil
from struct import pack
-from UserDict import IterableUserDict
-from UserList import UserList
+from collections import UserDict as IterableUserDict
+from collections import OrderedDict
from Common import EdkLogger as EdkLogger
from Common import GlobalData as GlobalData
@@ -654,7 +654,7 @@ def RealPath2(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]
@@ -673,7 +673,7 @@ def GuidValue(CName, PackageList, Inffile = None):
#
def ProtocolValue(CName, PackageList, Inffile = None):
for P in PackageList:
- ProtocolKeys = P.Protocols.keys()
+ ProtocolKeys = list(P.Protocols.keys())
if Inffile and P._PrivateProtocols:
if not Inffile.startswith(P.MetaFile.Dir):
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):
for P in PackageList:
- PpiKeys = P.Ppis.keys()
+ PpiKeys = list(P.Ppis.keys())
if Inffile and P._PrivatePpis:
if not Inffile.startswith(P.MetaFile.Dir):
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"
% (SkuName, SkuId))
- self.AvailableSkuIds = sdict()
+ self.AvailableSkuIds = OrderedDict()
self.SkuIdSet = []
self.SkuIdNumberSet = []
self.SkuData = SkuIds
@@ -1970,7 +1970,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('|')
diff --git a/BaseTools/Source/Python/Common/StringUtils.py b/BaseTools/Source/Python/Common/StringUtils.py
index f667c4c916..fe899b11d8 100644
--- a/BaseTools/Source/Python/Common/StringUtils.py
+++ b/BaseTools/Source/Python/Common/StringUtils.py
@@ -98,7 +98,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
#
@@ -544,7 +544,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()
@@ -750,7 +750,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
#