summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
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/Workspace
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/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/InfBuildData.py5
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py4
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceCommon.py8
3 files changed, 7 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index bf3da028c6..a725a2a2a7 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -788,10 +788,7 @@ class InfBuildData(ModuleBuildClassObject):
self._Includes.append(self._SourceOverridePath)
Macros = self._Macros
- if 'PROCESSOR' in GlobalData.gEdkGlobal.keys():
- Macros['PROCESSOR'] = GlobalData.gEdkGlobal['PROCESSOR']
- else:
- Macros['PROCESSOR'] = self._Arch
+ Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR', self._Arch)
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
for Record in RecordList:
if Record[0].find('EDK_SOURCE') > -1:
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index ae8cf57e38..3d12314717 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1504,12 +1504,12 @@ class DscParser(MetaFileParser):
# Allow using system environment variables in path after !include
#
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
- if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys():
+ if "ECP_SOURCE" in GlobalData.gGlobalDefines:
__IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']
#
# During GenFds phase call DSC parser, will go into this branch.
#
- elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys():
+ elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:
__IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']
__IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 17ac3b1054..736ef62534 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -1,7 +1,7 @@
## @file
# Common routines used by workspace
#
-# Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -63,11 +63,11 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain,additionalPk
PcdCName = Pcd[0]
PcdTokenName = Pcd[1]
if GlobalData.MixedPcd:
- for PcdItem in GlobalData.MixedPcd.keys():
+ for PcdItem in GlobalData.MixedPcd:
if (PcdCName, PcdTokenName) in GlobalData.MixedPcd[PcdItem]:
PcdCName = PcdItem[0]
break
- if (PcdCName, PcdTokenName) not in DecPcds.keys():
+ if (PcdCName, PcdTokenName) not in DecPcds:
DecPcds[PcdCName, PcdTokenName] = Pkg.Pcds[Pcd]
return DecPcds, GuidDict
@@ -243,7 +243,7 @@ def _ResolveLibraryReference(Module, Platform):
for LibraryName in M.Libraries:
Library = Platform.LibraryClasses[LibraryName, ':dummy:']
if Library is None:
- for Key in Platform.LibraryClasses.data.keys():
+ for Key in Platform.LibraryClasses.data:
if LibraryName.upper() == Key.upper():
Library = Platform.LibraryClasses[Key, ':dummy:']
break