summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenMake.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-17 22:40:15 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-04-18 22:15:36 +0800
commit9eb87141eca12b1f15afa4b769af04d1395891c6 (patch)
tree82ac481092b68ea3684f94bf7dc90c3c584aea52 /BaseTools/Source/Python/AutoGen/GenMake.py
parent55c84777ee638be8735a5c421941e7eb71633bdf (diff)
downloadedk2-9eb87141eca12b1f15afa4b769af04d1395891c6.tar.gz
edk2-9eb87141eca12b1f15afa4b769af04d1395891c6.tar.bz2
edk2-9eb87141eca12b1f15afa4b769af04d1395891c6.zip
BaseTools: refactor and remove un-needed use of .keys() on dictionaries
sometimes just delete it. sometimes the loop needed .values() instead Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenMake.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index b7594d8988..1bb5163e73 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -495,11 +495,11 @@ cleanlib:
if k not in self._AutoGenObject.Macros:
self._AutoGenObject.Macros[k] = v
- if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
+ if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros:
self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint
- if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
+ if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros:
self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint
- if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
+ if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros:
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint
PCI_COMPRESS_Flag = False
@@ -540,7 +540,7 @@ cleanlib:
RespFileList = os.path.join(self._AutoGenObject.OutputDir, 'respfilelist.txt')
if RespDict:
RespFileListContent = ''
- for Resp in RespDict.keys():
+ for Resp in RespDict:
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')
StrList = RespDict[Resp].split(' ')
UnexpandMacro = []
@@ -794,7 +794,7 @@ cleanlib:
SingleCommandLength = len(SingleCommand)
SingleCommandList = SingleCommand.split()
if len(SingleCommandList) > 0:
- for Flag in FlagDict.keys():
+ for Flag in FlagDict:
if '$('+ Flag +')' in SingleCommandList[0]:
Tool = Flag
break
@@ -807,12 +807,12 @@ cleanlib:
if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:
EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
- for Option in self._AutoGenObject.BuildOption.keys():
+ for Option in self._AutoGenObject.BuildOption:
for Attr in self._AutoGenObject.BuildOption[Option]:
if Str.find(Option + '_' + Attr) != -1:
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
while(Str.find('$(') != -1):
- for macro in self._AutoGenObject.Macros.keys():
+ for macro in self._AutoGenObject.Macros:
MacroName = '$('+ macro + ')'
if (Str.find(MacroName) != -1):
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
@@ -824,12 +824,12 @@ cleanlib:
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)
elif item.find('$(') != -1:
Str = item
- for Option in self._AutoGenObject.BuildOption.keys():
+ for Option in self._AutoGenObject.BuildOption:
for Attr in self._AutoGenObject.BuildOption[Option]:
if Str.find(Option + '_' + Attr) != -1:
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
while(Str.find('$(') != -1):
- for macro in self._AutoGenObject.Macros.keys():
+ for macro in self._AutoGenObject.Macros:
MacroName = '$('+ macro + ')'
if (Str.find(MacroName) != -1):
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
@@ -842,19 +842,19 @@ cleanlib:
FlagDict[Tool]['Value'] = True
# generate the response file content by combine the FLAGS and INC
- for Flag in FlagDict.keys():
+ for Flag in FlagDict:
if FlagDict[Flag]['Value']:
Key = Flag + '_RESP'
RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 'RESP')
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']
for inc in self._AutoGenObject._IncludePathList:
Value += ' ' + IncPrefix + inc
- for Option in self._AutoGenObject.BuildOption.keys():
+ for Option in self._AutoGenObject.BuildOption:
for Attr in self._AutoGenObject.BuildOption[Option]:
if Value.find(Option + '_' + Attr) != -1:
Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
while (Value.find('$(') != -1):
- for macro in self._AutoGenObject.Macros.keys():
+ for macro in self._AutoGenObject.Macros:
MacroName = '$('+ macro + ')'
if (Value.find(MacroName) != -1):
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])