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>
27 files changed:
for Module in Pa.ModuleAutoGenList:\r
if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):\r
InfFoundFlag = True\r
for Module in Pa.ModuleAutoGenList:\r
if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):\r
InfFoundFlag = True\r
- if not Module.Guid.upper() in _GuidDict.keys():\r
+ if Module.Guid.upper() not in _GuidDict:\r
_GuidDict[Module.Guid.upper()] = FfsFile\r
break\r
else:\r
_GuidDict[Module.Guid.upper()] = FfsFile\r
break\r
else:\r
# BuildObject from one of AutoGenObjectList is enough.\r
#\r
InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, TAB_COMMON, self.BuildTarget, self.ToolChain]\r
# BuildObject from one of AutoGenObjectList is enough.\r
#\r
InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, TAB_COMMON, self.BuildTarget, self.ToolChain]\r
- if not InfObj.Guid.upper() in _GuidDict.keys():\r
+ if InfObj.Guid.upper() not in _GuidDict:\r
_GuidDict[InfObj.Guid.upper()] = FfsFile\r
else:\r
EdkLogger.error("build",\r
_GuidDict[InfObj.Guid.upper()] = FfsFile\r
else:\r
EdkLogger.error("build",\r
"The format of PCD value is incorrect. PCD: %s , Value: %s\n" % (_PcdName, PcdItem.DefaultValue),\r
ExtraData=self.FdfFile)\r
\r
"The format of PCD value is incorrect. PCD: %s , Value: %s\n" % (_PcdName, PcdItem.DefaultValue),\r
ExtraData=self.FdfFile)\r
\r
- if not _PcdGuidString.upper() in _GuidDict.keys():\r
+ if _PcdGuidString.upper() not in _GuidDict:\r
_GuidDict[_PcdGuidString.upper()] = FfsFile\r
PcdFoundFlag = True\r
break\r
_GuidDict[_PcdGuidString.upper()] = FfsFile\r
PcdFoundFlag = True\r
break\r
FfsFile.NameGuid.upper()),\r
ExtraData=self.FdfFile)\r
\r
FfsFile.NameGuid.upper()),\r
ExtraData=self.FdfFile)\r
\r
- if not FfsFile.NameGuid.upper() in _GuidDict.keys():\r
+ if FfsFile.NameGuid.upper() not in _GuidDict:\r
_GuidDict[FfsFile.NameGuid.upper()] = FfsFile\r
else:\r
#\r
_GuidDict[FfsFile.NameGuid.upper()] = FfsFile\r
else:\r
#\r
PcdFromModule.IsFromBinaryInf = True\r
\r
# Check the PCD from DSC or not \r
PcdFromModule.IsFromBinaryInf = True\r
\r
# Check the PCD from DSC or not \r
- if (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds.keys():\r
- PcdFromModule.IsFromDsc = True\r
- else:\r
- PcdFromModule.IsFromDsc = False\r
+ PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds\r
+\r
if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:\r
if F.Path not in FdfModuleList:\r
# If one of the Source built modules listed in the DSC is not listed \r
if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:\r
if F.Path not in FdfModuleList:\r
# If one of the Source built modules listed in the DSC is not listed \r
VpdFile = VpdInfoFile.VpdInfoFile()\r
NeedProcessVpdMapFile = False\r
\r
VpdFile = VpdInfoFile.VpdInfoFile()\r
NeedProcessVpdMapFile = False\r
\r
- for pcd in self.Platform.Pcds.keys():\r
- if pcd not in self._PlatformPcds.keys():\r
+ for pcd in self.Platform.Pcds:\r
+ if pcd not in self._PlatformPcds:\r
self._PlatformPcds[pcd] = self.Platform.Pcds[pcd]\r
\r
for item in self._PlatformPcds:\r
self._PlatformPcds[pcd] = self.Platform.Pcds[pcd]\r
\r
for item in self._PlatformPcds:\r
if (self.Workspace.ArchList[-1] == self.Arch): \r
for Pcd in self._DynamicPcdList:\r
# just pick the a value to determine whether is unicode string type\r
if (self.Workspace.ArchList[-1] == self.Arch): \r
for Pcd in self._DynamicPcdList:\r
# just pick the a value to determine whether is unicode string type\r
- Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]\r
+ Sku = Pcd.SkuInfoList.values()[0]\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
\r
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
\r
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:\r
if not (self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == ''):\r
FoundFlag = False\r
if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:\r
if not (self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == ''):\r
FoundFlag = False\r
- for VpdPcd in VpdFile._VpdArray.keys():\r
+ for VpdPcd in VpdFile._VpdArray:\r
# This PCD has been referenced by module\r
if (VpdPcd.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \\r
(VpdPcd.TokenCName == DscPcdEntry.TokenCName):\r
# This PCD has been referenced by module\r
if (VpdPcd.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \\r
(VpdPcd.TokenCName == DscPcdEntry.TokenCName):\r
# Delete the DynamicPcdList At the last time enter into this function\r
for Pcd in self._DynamicPcdList:\r
# just pick the a value to determine whether is unicode string type\r
# Delete the DynamicPcdList At the last time enter into this function\r
for Pcd in self._DynamicPcdList:\r
# just pick the a value to determine whether is unicode string type\r
- Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]\r
+ Sku = Pcd.SkuInfoList.values()[0]\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
\r
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
Sku.VpdOffset = Sku.VpdOffset.strip()\r
\r
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
for LibraryName in M.Libraries:\r
Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']\r
if Library is None:\r
for LibraryName in M.Libraries:\r
Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']\r
if Library is None:\r
- for Key in self.Platform.LibraryClasses.data.keys():\r
+ for Key in self.Platform.LibraryClasses.data:\r
if LibraryName.upper() == Key.upper():\r
Library = self.Platform.LibraryClasses[Key, ':dummy:']\r
break\r
if LibraryName.upper() == Key.upper():\r
Library = self.Platform.LibraryClasses[Key, ':dummy:']\r
break\r
InfObj = InfSectionParser.InfSectionParser(Filename)\r
DepexExpresionList = InfObj.GetDepexExpresionList()\r
for DepexExpresion in DepexExpresionList:\r
InfObj = InfSectionParser.InfSectionParser(Filename)\r
DepexExpresionList = InfObj.GetDepexExpresionList()\r
for DepexExpresion in DepexExpresionList:\r
- for key in DepexExpresion.keys():\r
+ for key in DepexExpresion:\r
Arch, ModuleType = key\r
DepexExpr = [x for x in DepexExpresion[key] if not str(x).startswith('#')]\r
# the type of build module is USER_DEFINED.\r
Arch, ModuleType = key\r
DepexExpr = [x for x in DepexExpresion[key] if not str(x).startswith('#')]\r
# the type of build module is USER_DEFINED.\r
#the type of build module is USER_DEFINED.\r
if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:\r
for Depex in DepexList:\r
#the type of build module is USER_DEFINED.\r
if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:\r
for Depex in DepexList:\r
- for key in Depex.keys():\r
DepexStr += '[Depex.%s.%s]\n' % key\r
DepexStr += '\n'.join(['# '+ val for val in Depex[key]])\r
DepexStr += '\n\n'\r
DepexStr += '[Depex.%s.%s]\n' % key\r
DepexStr += '\n'.join(['# '+ val for val in Depex[key]])\r
DepexStr += '\n\n'\r
InfObj = InfSectionParser.InfSectionParser(Filename)\r
TianoCoreUserExtenList = InfObj.GetUserExtensionTianoCore()\r
for TianoCoreUserExtent in TianoCoreUserExtenList:\r
InfObj = InfSectionParser.InfSectionParser(Filename)\r
TianoCoreUserExtenList = InfObj.GetUserExtensionTianoCore()\r
for TianoCoreUserExtent in TianoCoreUserExtenList:\r
- for Section in TianoCoreUserExtent.keys():\r
+ for Section in TianoCoreUserExtent:\r
ItemList = Section.split(TAB_SPLIT)\r
Arch = self.Arch\r
if len(ItemList) == 4:\r
ItemList = Section.split(TAB_SPLIT)\r
Arch = self.Arch\r
if len(ItemList) == 4:\r
if k not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros[k] = v\r
\r
if k not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros[k] = v\r
\r
- if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
- if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
- if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
\r
PCI_COMPRESS_Flag = False\r
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
\r
PCI_COMPRESS_Flag = False\r
RespFileList = os.path.join(self._AutoGenObject.OutputDir, 'respfilelist.txt')\r
if RespDict:\r
RespFileListContent = ''\r
RespFileList = os.path.join(self._AutoGenObject.OutputDir, 'respfilelist.txt')\r
if RespDict:\r
RespFileListContent = ''\r
- for Resp in RespDict.keys():\r
+ for Resp in RespDict:\r
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
StrList = RespDict[Resp].split(' ')\r
UnexpandMacro = []\r
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
StrList = RespDict[Resp].split(' ')\r
UnexpandMacro = []\r
SingleCommandLength = len(SingleCommand)\r
SingleCommandList = SingleCommand.split()\r
if len(SingleCommandList) > 0:\r
SingleCommandLength = len(SingleCommand)\r
SingleCommandList = SingleCommand.split()\r
if len(SingleCommandList) > 0:\r
- for Flag in FlagDict.keys():\r
+ for Flag in FlagDict:\r
if '$('+ Flag +')' in SingleCommandList[0]:\r
Tool = Flag\r
break\r
if '$('+ Flag +')' in SingleCommandList[0]:\r
Tool = Flag\r
break\r
if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:\r
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))\r
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:\r
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))\r
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)\r
elif item.find('$(') != -1:\r
Str = item\r
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)\r
elif item.find('$(') != -1:\r
Str = item\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
FlagDict[Tool]['Value'] = True\r
\r
# generate the response file content by combine the FLAGS and INC\r
FlagDict[Tool]['Value'] = True\r
\r
# generate the response file content by combine the FLAGS and INC\r
- for Flag in FlagDict.keys():\r
+ for Flag in FlagDict:\r
if FlagDict[Flag]['Value']:\r
Key = Flag + '_RESP'\r
RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 'RESP')\r
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']\r
for inc in self._AutoGenObject._IncludePathList:\r
Value += ' ' + IncPrefix + inc\r
if FlagDict[Flag]['Value']:\r
Key = Flag + '_RESP'\r
RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 'RESP')\r
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']\r
for inc in self._AutoGenObject._IncludePathList:\r
Value += ' ' + IncPrefix + inc\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Value.find(Option + '_' + Attr) != -1:\r
Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while (Value.find('$(') != -1):\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Value.find(Option + '_' + Attr) != -1:\r
Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while (Value.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Value.find(MacroName) != -1):\r
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])\r
MacroName = '$('+ macro + ')'\r
if (Value.find(MacroName) != -1):\r
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])\r
self.VarInfo = [item[0] for item in indexedvarinfo.values()]\r
\r
def assemble_variable(self, valuelist):\r
self.VarInfo = [item[0] for item in indexedvarinfo.values()]\r
\r
def assemble_variable(self, valuelist):\r
- ordered_value = [valuelist[k] for k in sorted(valuelist.keys())]\r
ordered_offset = sorted(valuelist.keys())\r
ordered_offset = sorted(valuelist.keys())\r
+ ordered_value = [valuelist[k] for k in ordered_offset]\r
var_value = []\r
num = 0\r
for offset in ordered_offset:\r
var_value = []\r
num = 0\r
for offset in ordered_offset:\r
## @file\r
# Parser a Inf file and Get specify section data.\r
#\r
## @file\r
# Parser a Inf file and Get specify section data.\r
#\r
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
if not self._FileSectionDataList:\r
return UserExtensionTianoCore\r
for SectionDataDict in self._FileSectionDataList:\r
if not self._FileSectionDataList:\r
return UserExtensionTianoCore\r
for SectionDataDict in self._FileSectionDataList:\r
- for key in SectionDataDict.keys():\r
+ for key in SectionDataDict:\r
if key.lower().startswith("[userextensions") and key.lower().find('.tianocore.') > -1:\r
SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)\r
SubSectionList = [SectionLine]\r
if key.lower().startswith("[userextensions") and key.lower().find('.tianocore.') > -1:\r
SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)\r
SubSectionList = [SectionLine]\r
if not self._FileSectionDataList:\r
return DepexExpresionList\r
for SectionDataDict in self._FileSectionDataList:\r
if not self._FileSectionDataList:\r
return DepexExpresionList\r
for SectionDataDict in self._FileSectionDataList:\r
- for key in SectionDataDict.keys():\r
+ for key in SectionDataDict:\r
if key.lower() == "[depex]" or key.lower().startswith("[depex."):\r
SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)\r
SubSectionList = [SectionLine]\r
if key.lower() == "[depex]" or key.lower().startswith("[depex."):\r
SectionLine = key.lstrip(TAB_SECTION_START).rstrip(TAB_SECTION_END)\r
SubSectionList = [SectionLine]\r
# \r
# \r
def _PackIntValue(self, IntValue, Size):\r
# \r
# \r
def _PackIntValue(self, IntValue, Size):\r
- if Size not in _FORMAT_CHAR.keys():\r
+ if Size not in _FORMAT_CHAR:\r
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,\r
"Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))\r
\r
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,\r
"Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))\r
\r
## @file\r
# This is the base class for applications that operate on an EDK II Workspace \r
#\r
## @file\r
# This is the base class for applications that operate on an EDK II Workspace \r
#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
except:\r
Lines = []\r
Keys = Dictionary.keys()\r
except:\r
Lines = []\r
Keys = Dictionary.keys()\r
- MaxLength = 0\r
- for Key in Keys:\r
- if len(Key) > MaxLength:\r
- MaxLength = len(Key)\r
+ MaxLength = max(map(len,Keys))\r
Index = 0\r
for Line in Lines:\r
LineList = Line.split(KeySplitCharacter, 1)\r
Index = 0\r
for Line in Lines:\r
LineList = Line.split(KeySplitCharacter, 1)\r
InQuote = True\r
MacroStartPos = String.find('$(')\r
if MacroStartPos < 0:\r
InQuote = True\r
MacroStartPos = String.find('$(')\r
if MacroStartPos < 0:\r
- for Pcd in gPlatformPcds.keys():\r
+ for Pcd in gPlatformPcds:\r
if Pcd in String:\r
if Pcd not in gConditionalPcds:\r
gConditionalPcds.append(Pcd)\r
if Pcd in String:\r
if Pcd not in gConditionalPcds:\r
gConditionalPcds.append(Pcd)\r
for Label in LabelList:\r
if not IsValidCName(Label):\r
raise BadExpression('%s is not a valid c variable name' % Label)\r
for Label in LabelList:\r
if not IsValidCName(Label):\r
raise BadExpression('%s is not a valid c variable name' % Label)\r
- if Label not in LabelDict.keys():\r
+ if Label not in LabelDict:\r
LabelDict[Label] = str(LabelOffset)\r
if Item.startswith('UINT8'):\r
LabelOffset = LabelOffset + 1\r
LabelDict[Label] = str(LabelOffset)\r
if Item.startswith('UINT8'):\r
LabelOffset = LabelOffset + 1\r
if not self.DefaultStores or "0" in self.DefaultStores:\r
return "0",TAB_DEFAULT_STORES_DEFAULT\r
else:\r
if not self.DefaultStores or "0" in self.DefaultStores:\r
return "0",TAB_DEFAULT_STORES_DEFAULT\r
else:\r
- minvalue = min([int(value_str) for value_str in self.DefaultStores.keys()])\r
+ minvalue = min([int(value_str) for value_str in self.DefaultStores])\r
return (str(minvalue), self.DefaultStores[str(minvalue)])\r
def GetMin(self,DefaultSIdList):\r
if not DefaultSIdList:\r
return (str(minvalue), self.DefaultStores[str(minvalue)])\r
def GetMin(self,DefaultSIdList):\r
if not DefaultSIdList:\r
## @file\r
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process\r
#\r
## @file\r
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process\r
#\r
-# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
#\r
# Overrided by Global Macros\r
#\r
#\r
# Overrided by Global Macros\r
#\r
- for Key in GlobalMacro.keys():\r
- Macros[Key] = GlobalMacro[Key]\r
+ Macros.update(GlobalMacro)\r
\r
#\r
# Replace the Macros\r
#\r
\r
#\r
# Replace the Macros\r
#\r
- for Key in RecordSets.keys():\r
- if RecordSets[Key] != []:\r
- for Item in RecordSets[Key]:\r
- Item[0] = ReplaceMacro(Item[0], Macros)\r
+ for Value in (v for v in RecordSets.values() if v):\r
+ for Item in Value:\r
+ Item[0] = ReplaceMacro(Item[0], Macros)\r
\r
## ParseDefineMacro\r
#\r
\r
## ParseDefineMacro\r
#\r
#\r
# Overrided by Global Macros\r
#\r
#\r
# Overrided by Global Macros\r
#\r
- for Key in GlobalMacro.keys():\r
- Macros[Key] = GlobalMacro[Key]\r
+ Macros.update(GlobalMacro)\r
\r
#\r
# Found all defined macro and replaced\r
\r
#\r
# Found all defined macro and replaced\r
## @file\r
# This file is used to define common string related functions used in parsing process\r
#\r
## @file\r
# This file is used to define common string related functions used in parsing process\r
#\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# @param Arch: The Arch to be added or merged\r
#\r
def MergeArches(Dict, Key, Arch):\r
# @param Arch: The Arch to be added or merged\r
#\r
def MergeArches(Dict, Key, Arch):\r
- if Key in Dict.keys():\r
Dict[Key].append(Arch)\r
else:\r
Dict[Key] = Arch.split()\r
Dict[Key].append(Arch)\r
else:\r
Dict[Key] = Arch.split()\r
# is pointed by *_*_*_VPD_TOOL_GUID in conf/tools_def.txt \r
#\r
#\r
# is pointed by *_*_*_VPD_TOOL_GUID in conf/tools_def.txt \r
#\r
#\r
-# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,\r
"Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))\r
\r
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,\r
"Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))\r
\r
- if Vpd not in self._VpdArray.keys():\r
+ if Vpd not in self._VpdArray:\r
#\r
# If there is no Vpd instance in dict, that imply this offset for a given SKU is a new one \r
#\r
#\r
# If there is no Vpd instance in dict, that imply this offset for a given SKU is a new one \r
#\r
if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:\r
self._VpdInfo[(TokenSpaceName, PcdTokenName)] = []\r
self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId,Offset, Value))\r
if (TokenSpaceName, PcdTokenName) not in self._VpdInfo:\r
self._VpdInfo[(TokenSpaceName, PcdTokenName)] = []\r
self._VpdInfo[(TokenSpaceName, PcdTokenName)].append((SkuId,Offset, Value))\r
- for VpdObject in self._VpdArray.keys():\r
+ for VpdObject in self._VpdArray:\r
VpdObjectTokenCName = VpdObject.TokenCName\r
for PcdItem in GlobalData.MixedPcd:\r
if (VpdObject.TokenCName, VpdObject.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:\r
VpdObjectTokenCName = PcdItem[0]\r
VpdObjectTokenCName = VpdObject.TokenCName\r
for PcdItem in GlobalData.MixedPcd:\r
if (VpdObject.TokenCName, VpdObject.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:\r
VpdObjectTokenCName = PcdItem[0]\r
- for sku in VpdObject.SkuInfoList.keys():\r
+ for sku in VpdObject.SkuInfoList:\r
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:\r
if self._VpdArray[VpdObject][sku] == "*":\r
if Offset == "*":\r
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:\r
if self._VpdArray[VpdObject][sku] == "*":\r
if Offset == "*":\r
## @file\r
# generate capsule\r
#\r
## @file\r
# generate capsule\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# @retval string Generated Capsule file path\r
#\r
def GenCapsule(self):\r
# @retval string Generated Capsule file path\r
#\r
def GenCapsule(self):\r
- if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():\r
+ if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict:\r
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']\r
\r
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)\r
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']\r
\r
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)\r
\r
CapInfFile.writelines("[options]" + T_CHAR_LF)\r
\r
\r
CapInfFile.writelines("[options]" + T_CHAR_LF)\r
\r
- for Item in self.TokensDict.keys():\r
+ for Item in self.TokensDict:\r
CapInfFile.writelines("EFI_" + \\r
Item + \\r
' = ' + \\r
CapInfFile.writelines("EFI_" + \\r
Item + \\r
' = ' + \\r
- self.TokensDict.get(Item) + \\r
+ self.TokensDict[Item] + \\r
T_CHAR_LF)\r
\r
return CapInfFile\r
T_CHAR_LF)\r
\r
return CapInfFile\r
## @file\r
# generate capsule\r
#\r
## @file\r
# generate capsule\r
#\r
-# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
def GenCapsuleSubItem(self):\r
if self.FvName.find('.fv') == -1:\r
#\r
def GenCapsuleSubItem(self):\r
if self.FvName.find('.fv') == -1:\r
- if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
+ if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]\r
FdBuffer = StringIO.StringIO('')\r
FvObj.CapsuleName = self.CapsuleName\r
FvFile = FvObj.AddToBuffer(FdBuffer)\r
FdBuffer = StringIO.StringIO('')\r
FvObj.CapsuleName = self.CapsuleName\r
FvFile = FvObj.AddToBuffer(FdBuffer)\r
#\r
def GenCapsuleSubItem(self):\r
if self.FdName.find('.fd') == -1:\r
#\r
def GenCapsuleSubItem(self):\r
if self.FdName.find('.fd') == -1:\r
- if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
+ if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[self.FdName.upper()]\r
FdFile = FdObj.GenFd()\r
return FdFile\r
else:\r
FdFile = FdObj.GenFd()\r
return FdFile\r
else:\r
## @file\r
# process FD generation\r
#\r
## @file\r
# process FD generation\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# @retval string Generated FD file name\r
#\r
def GenFd (self, Flag = False):\r
# @retval string Generated FD file name\r
#\r
def GenFd (self, Flag = False):\r
- if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():\r
+ if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict:\r
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']\r
\r
#\r
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']\r
\r
#\r
if not self.__GetNextToken():\r
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)\r
\r
if not self.__GetNextToken():\r
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)\r
\r
- if self.__Token.upper() not in self.Profile.FvDict.keys():\r
+ if self.__Token.upper() not in self.Profile.FvDict:\r
raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)\r
\r
CapsuleFv = CapsuleData.CapsuleFv()\r
raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)\r
\r
CapsuleFv = CapsuleData.CapsuleFv()\r
if not self.__GetNextToken():\r
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)\r
\r
if not self.__GetNextToken():\r
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)\r
\r
- if self.__Token.upper() not in self.Profile.FdDict.keys():\r
+ if self.__Token.upper() not in self.Profile.FdDict:\r
raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)\r
\r
CapsuleFd = CapsuleData.CapsuleFd()\r
raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)\r
\r
CapsuleFd = CapsuleData.CapsuleFd()\r
def __GetCapInFd (self, FdName):\r
\r
CapList = []\r
def __GetCapInFd (self, FdName):\r
\r
CapList = []\r
- if FdName.upper() in self.Profile.FdDict.keys():\r
+ if FdName.upper() in self.Profile.FdDict:\r
FdObj = self.Profile.FdDict[FdName.upper()]\r
for elementRegion in FdObj.RegionList:\r
if elementRegion.RegionType == 'CAPSULE':\r
FdObj = self.Profile.FdDict[FdName.upper()]\r
for elementRegion in FdObj.RegionList:\r
if elementRegion.RegionType == 'CAPSULE':\r
def __GetFvInFd (self, FdName):\r
\r
FvList = []\r
def __GetFvInFd (self, FdName):\r
\r
FvList = []\r
- if FdName.upper() in self.Profile.FdDict.keys():\r
+ if FdName.upper() in self.Profile.FdDict:\r
FdObj = self.Profile.FdDict[FdName.upper()]\r
for elementRegion in FdObj.RegionList:\r
if elementRegion.RegionType == 'FV':\r
FdObj = self.Profile.FdDict[FdName.upper()]\r
for elementRegion in FdObj.RegionList:\r
if elementRegion.RegionType == 'FV':\r
# Check the cycle between FV and FD image\r
#\r
MaxLength = len (self.Profile.FvDict)\r
# Check the cycle between FV and FD image\r
#\r
MaxLength = len (self.Profile.FvDict)\r
- for FvName in self.Profile.FvDict.keys():\r
+ for FvName in self.Profile.FvDict:\r
LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName\r
RefFvStack = []\r
RefFvStack.append(FvName)\r
LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName\r
RefFvStack = []\r
RefFvStack.append(FvName)\r
while RefFvStack != [] and Index < MaxLength:\r
Index = Index + 1\r
FvNameFromStack = RefFvStack.pop()\r
while RefFvStack != [] and Index < MaxLength:\r
Index = Index + 1\r
FvNameFromStack = RefFvStack.pop()\r
- if FvNameFromStack.upper() in self.Profile.FvDict.keys():\r
+ if FvNameFromStack.upper() in self.Profile.FvDict:\r
FvObj = self.Profile.FvDict[FvNameFromStack.upper()]\r
else:\r
continue\r
FvObj = self.Profile.FvDict[FvNameFromStack.upper()]\r
else:\r
continue\r
# Check the cycle between Capsule and FD image\r
#\r
MaxLength = len (self.Profile.CapsuleDict)\r
# Check the cycle between Capsule and FD image\r
#\r
MaxLength = len (self.Profile.CapsuleDict)\r
- for CapName in self.Profile.CapsuleDict.keys():\r
+ for CapName in self.Profile.CapsuleDict:\r
#\r
# Capsule image to be checked.\r
#\r
#\r
# Capsule image to be checked.\r
#\r
while RefCapStack != [] and Index < MaxLength:\r
Index = Index + 1\r
CapNameFromStack = RefCapStack.pop()\r
while RefCapStack != [] and Index < MaxLength:\r
Index = Index + 1\r
CapNameFromStack = RefCapStack.pop()\r
- if CapNameFromStack.upper() in self.Profile.CapsuleDict.keys():\r
+ if CapNameFromStack.upper() in self.Profile.CapsuleDict:\r
CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]\r
else:\r
continue\r
CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]\r
else:\r
continue\r
if RefFvName in FvAnalyzedList:\r
continue\r
LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)\r
if RefFvName in FvAnalyzedList:\r
continue\r
LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)\r
- if RefFvName.upper() in self.Profile.FvDict.keys():\r
+ if RefFvName.upper() in self.Profile.FvDict:\r
FvObj = self.Profile.FvDict[RefFvName.upper()]\r
else:\r
continue\r
FvObj = self.Profile.FvDict[RefFvName.upper()]\r
else:\r
continue\r
## @file\r
# process FFS generation from FILE statement\r
#\r
## @file\r
# process FFS generation from FILE statement\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
SectionAlignments = None\r
if self.FvName is not None :\r
Buffer = StringIO.StringIO('')\r
SectionAlignments = None\r
if self.FvName is not None :\r
Buffer = StringIO.StringIO('')\r
- if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
+ if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))\r
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
FileName = Fv.AddToBuffer(Buffer)\r
SectionFiles = [FileName]\r
\r
elif self.FdName is not None:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))\r
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
FileName = Fv.AddToBuffer(Buffer)\r
SectionFiles = [FileName]\r
\r
elif self.FdName is not None:\r
- if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+ if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
FileName = Fd.GenFd()\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
FileName = Fd.GenFd()\r
# the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,\r
# but the path (self.MetaFile.Path) is the real path\r
#\r
# the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,\r
# but the path (self.MetaFile.Path) is the real path\r
#\r
- for key in PlatformDataBase.Modules.keys():\r
+ for key in PlatformDataBase.Modules:\r
if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):\r
DscArchList.append (Arch)\r
break\r
if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):\r
DscArchList.append (Arch)\r
break\r
#\r
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :\r
\r
#\r
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :\r
\r
- if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
+ if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict:\r
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']\r
\r
#\r
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']\r
\r
#\r
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.\r
#\r
if self.CapsuleName is not None:\r
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.\r
#\r
if self.CapsuleName is not None:\r
- for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
for RegionObj in FdObj.RegionList:\r
if RegionObj.RegionType == 'FV':\r
for RegionData in RegionObj.RegionDataList:\r
if RegionData.endswith(".fv"):\r
continue\r
for RegionObj in FdObj.RegionList:\r
if RegionObj.RegionType == 'FV':\r
for RegionData in RegionObj.RegionDataList:\r
if RegionData.endswith(".fv"):\r
continue\r
- elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
+ elif RegionData.upper() + 'fv' in GenFds.ImageBinDict:\r
continue\r
elif self.UiFvName.upper() == RegionData.upper():\r
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
continue\r
elif self.UiFvName.upper() == RegionData.upper():\r
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
if self.BlockSizeList:\r
return True\r
\r
if self.BlockSizeList:\r
return True\r
\r
- for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
for RegionObj in FdObj.RegionList:\r
if RegionObj.RegionType != 'FV':\r
continue\r
for RegionObj in FdObj.RegionList:\r
if RegionObj.RegionType != 'FV':\r
continue\r
# Add [Files]\r
#\r
self.FvInfFile.writelines("[files]" + T_CHAR_LF)\r
# Add [Files]\r
#\r
self.FvInfFile.writelines("[files]" + T_CHAR_LF)\r
- if VtfDict is not None and self.UiFvName in VtfDict.keys():\r
+ if VtfDict is not None and self.UiFvName in VtfDict:\r
self.FvInfFile.writelines("EFI_FILE_NAME = " + \\r
self.FvInfFile.writelines("EFI_FILE_NAME = " + \\r
- VtfDict.get(self.UiFvName) + \\r
+ VtfDict[self.UiFvName] + \\r
else:\r
Workspace = os.path.normcase(Options.Workspace)\r
GenFdsGlobalVariable.WorkSpaceDir = Workspace\r
else:\r
Workspace = os.path.normcase(Options.Workspace)\r
GenFdsGlobalVariable.WorkSpaceDir = Workspace\r
- if 'EDK_SOURCE' in os.environ.keys():\r
+ if 'EDK_SOURCE' in os.environ:\r
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])\r
if (Options.debug):\r
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)\r
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])\r
if (Options.debug):\r
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)\r
# This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf\r
ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)\r
else:\r
# This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf\r
ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)\r
else:\r
- if "CONF_PATH" in os.environ.keys():\r
+ if "CONF_PATH" in os.environ:\r
ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])\r
else:\r
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf\r
ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])\r
else:\r
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf\r
os.environ["WORKSPACE"] = Workspace\r
\r
# Use the -t and -b option as gGlobalDefines's TOOLCHAIN and TARGET if they are not defined\r
os.environ["WORKSPACE"] = Workspace\r
\r
# Use the -t and -b option as gGlobalDefines's TOOLCHAIN and TARGET if they are not defined\r
- if "TARGET" not in GlobalData.gGlobalDefines.keys():\r
+ if "TARGET" not in GlobalData.gGlobalDefines:\r
GlobalData.gGlobalDefines["TARGET"] = GenFdsGlobalVariable.TargetName\r
GlobalData.gGlobalDefines["TARGET"] = GenFdsGlobalVariable.TargetName\r
- if "TOOLCHAIN" not in GlobalData.gGlobalDefines.keys():\r
+ if "TOOLCHAIN" not in GlobalData.gGlobalDefines:\r
GlobalData.gGlobalDefines["TOOLCHAIN"] = GenFdsGlobalVariable.ToolChainTag\r
GlobalData.gGlobalDefines["TOOLCHAIN"] = GenFdsGlobalVariable.ToolChainTag\r
- if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines.keys():\r
+ if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines:\r
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = GenFdsGlobalVariable.ToolChainTag\r
\r
"""call Workspace build create database"""\r
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = GenFdsGlobalVariable.ToolChainTag\r
\r
"""call Workspace build create database"""\r
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")\r
\r
if (Options.uiFdName) :\r
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")\r
\r
if (Options.uiFdName) :\r
- if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():\r
+ if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict:\r
GenFds.OnlyGenerateThisFd = Options.uiFdName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
"No such an FD in FDF file: %s" % Options.uiFdName)\r
\r
if (Options.uiFvName) :\r
GenFds.OnlyGenerateThisFd = Options.uiFdName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
"No such an FD in FDF file: %s" % Options.uiFdName)\r
\r
if (Options.uiFvName) :\r
- if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():\r
+ if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict:\r
GenFds.OnlyGenerateThisFv = Options.uiFvName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
"No such an FV in FDF file: %s" % Options.uiFvName)\r
\r
if (Options.uiCapName) :\r
GenFds.OnlyGenerateThisFv = Options.uiFvName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
"No such an FV in FDF file: %s" % Options.uiFvName)\r
\r
if (Options.uiCapName) :\r
- if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict.keys():\r
+ if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict:\r
GenFds.OnlyGenerateThisCap = Options.uiCapName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
GenFds.OnlyGenerateThisCap = Options.uiCapName\r
else:\r
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,\r
KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)\r
\r
if GenFdsGlobalVariable.GuidToolDefinition:\r
KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)\r
\r
if GenFdsGlobalVariable.GuidToolDefinition:\r
- if NameGuid in GenFdsGlobalVariable.GuidToolDefinition.keys():\r
+ if NameGuid in GenFdsGlobalVariable.GuidToolDefinition:\r
return GenFdsGlobalVariable.GuidToolDefinition[NameGuid]\r
\r
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
return GenFdsGlobalVariable.GuidToolDefinition[NameGuid]\r
\r
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
if Key in KeyStringList and KeyList[4] == 'GUID':\r
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'\r
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'\r
if Key in KeyStringList and KeyList[4] == 'GUID':\r
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'\r
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'\r
- if ToolPathKey in BuildOption.keys():\r
- ToolPathTmp = BuildOption.get(ToolPathKey)\r
- if ToolOptionKey in BuildOption.keys():\r
- ToolOption = BuildOption.get(ToolOptionKey)\r
+ if ToolPathKey in BuildOption:\r
+ ToolPathTmp = BuildOption[ToolPathKey]\r
+ if ToolOptionKey in BuildOption:\r
+ ToolOption = BuildOption[ToolOptionKey]\r
\r
GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)\r
return ToolPathTmp, ToolOption\r
\r
GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)\r
return ToolPathTmp, ToolOption\r
GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)\r
\r
GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")\r
GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)\r
\r
GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")\r
- if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
- CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.get(GenFds.OnlyGenerateThisCap.upper())\r
+ if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:\r
+ CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[GenFds.OnlyGenerateThisCap.upper()]\r
if CapsuleObj is not None:\r
CapsuleObj.GenCapsule()\r
return\r
\r
if CapsuleObj is not None:\r
CapsuleObj.GenCapsule()\r
return\r
\r
- if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())\r
+ if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
+ FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]\r
if FdObj is not None:\r
FdObj.GenFd()\r
return\r
elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:\r
if FdObj is not None:\r
FdObj.GenFd()\r
return\r
elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:\r
- for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
FdObj.GenFd()\r
\r
GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")\r
FdObj.GenFd()\r
\r
GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")\r
- if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())\r
+ if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[GenFds.OnlyGenerateThisFv.upper()]\r
if FvObj is not None:\r
Buffer = StringIO.StringIO()\r
FvObj.AddToBuffer(Buffer)\r
Buffer.close()\r
return\r
elif GenFds.OnlyGenerateThisFv is None:\r
if FvObj is not None:\r
Buffer = StringIO.StringIO()\r
FvObj.AddToBuffer(Buffer)\r
Buffer.close()\r
return\r
elif GenFds.OnlyGenerateThisFv is None:\r
- for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
+ for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():\r
Buffer = StringIO.StringIO('')\r
Buffer = StringIO.StringIO('')\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]\r
FvObj.AddToBuffer(Buffer)\r
Buffer.close()\r
\r
if GenFds.OnlyGenerateThisFv is None and GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisCap is None:\r
if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:\r
GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")\r
FvObj.AddToBuffer(Buffer)\r
Buffer.close()\r
\r
if GenFds.OnlyGenerateThisFv is None and GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisCap is None:\r
if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:\r
GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")\r
- for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
- CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName]\r
+ for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.values():\r
CapsuleObj.GenCapsule()\r
\r
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:\r
GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")\r
CapsuleObj.GenCapsule()\r
\r
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:\r
GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")\r
- for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():\r
- OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]\r
+ for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():\r
OptRomObj.AddToBuffer(None)\r
@staticmethod\r
def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, GlobalData):\r
GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, GlobalData)\r
OptRomObj.AddToBuffer(None)\r
@staticmethod\r
def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, GlobalData):\r
GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, GlobalData)\r
- for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
- FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
+ for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
FdObj.GenFd(Flag=True)\r
\r
FdObj.GenFd(Flag=True)\r
\r
- for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]\r
+ for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():\r
FvObj.AddToBuffer(Buffer=None, Flag=True)\r
\r
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:\r
FvObj.AddToBuffer(Buffer=None, Flag=True)\r
\r
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:\r
- for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():\r
- OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]\r
+ for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():\r
OptRomObj.AddToBuffer(Buffer=None, Flag=True)\r
\r
return GenFdsGlobalVariable.FfsCmdDict\r
OptRomObj.AddToBuffer(Buffer=None, Flag=True)\r
\r
return GenFdsGlobalVariable.FfsCmdDict\r
def GetFvBlockSize(FvObj):\r
DefaultBlockSize = 0x1\r
FdObj = None\r
def GetFvBlockSize(FvObj):\r
DefaultBlockSize = 0x1\r
FdObj = None\r
- if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+ if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:\r
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]\r
if FdObj is None:\r
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]\r
if FdObj is None:\r
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))\r
if MakefilePath:\r
\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))\r
if MakefilePath:\r
- if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict.keys():\r
+ if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:\r
GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath\r
GenFdsGlobalVariable.SecCmdList = []\r
GenFdsGlobalVariable.CopyList = []\r
GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath\r
GenFdsGlobalVariable.SecCmdList = []\r
GenFdsGlobalVariable.CopyList = []\r
if MacroDict is not None and len (MacroDict) != 0:\r
Dict.update(MacroDict)\r
\r
if MacroDict is not None and len (MacroDict) != 0:\r
Dict.update(MacroDict)\r
\r
- for key in Dict.keys():\r
if Str.find(key) >= 0 :\r
Str = Str.replace (key, Dict[key])\r
\r
if Str.find(key) >= 0 :\r
Str = Str.replace (key, Dict[key])\r
\r
## @file\r
# process FD Region generation\r
#\r
## @file\r
# process FD Region generation\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
\r
FileName = RegionData\r
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
\r
FileName = RegionData\r
- elif RegionData.upper() + 'fv' in ImageBinDict.keys():\r
+ elif RegionData.upper() + 'fv' in ImageBinDict:\r
if not Flag:\r
GenFdsGlobalVariable.InfLogger(' Region Name = FV')\r
FileName = ImageBinDict[RegionData.upper() + 'fv']\r
if not Flag:\r
GenFdsGlobalVariable.InfLogger(' Region Name = FV')\r
FileName = ImageBinDict[RegionData.upper() + 'fv']\r
# Generate FvImage.\r
#\r
FvObj = None\r
# Generate FvImage.\r
#\r
FvObj = None\r
- if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
- FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
+ if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
+ FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[RegionData.upper()]\r
\r
if FvObj is not None :\r
if not Flag:\r
\r
if FvObj is not None :\r
if not Flag:\r
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
\r
FileName = RegionData\r
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
\r
FileName = RegionData\r
- elif RegionData.upper() + 'cap' in ImageBinDict.keys():\r
+ elif RegionData.upper() + 'cap' in ImageBinDict:\r
GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')\r
FileName = ImageBinDict[RegionData.upper() + 'cap']\r
else:\r
GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')\r
FileName = ImageBinDict[RegionData.upper() + 'cap']\r
else:\r
# Generate Capsule image and Put it into FD buffer\r
#\r
CapsuleObj = None\r
# Generate Capsule image and Put it into FD buffer\r
#\r
CapsuleObj = None\r
- if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
+ if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:\r
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]\r
\r
if CapsuleObj is not None :\r
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]\r
\r
if CapsuleObj is not None :\r
## @file\r
# Target Tool Parser\r
#\r
## @file\r
# Target Tool Parser\r
#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
LineList = Line.split(KeySplitCharacter,1)\r
if len(LineList) >= 2:\r
Key = LineList[0].strip()\r
LineList = Line.split(KeySplitCharacter,1)\r
if len(LineList) >= 2:\r
Key = LineList[0].strip()\r
- if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary.keys():\r
+ if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary:\r
if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM or Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF \\r
or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \\r
or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:\r
if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM or Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF \\r
or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \\r
or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:\r
LineList = Line.split(KeySplitCharacter,1)\r
if len(LineList) >= 2:\r
Key = LineList[0].strip()\r
LineList = Line.split(KeySplitCharacter,1)\r
if len(LineList) >= 2:\r
Key = LineList[0].strip()\r
- if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary.keys():\r
+ if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary:\r
if Key not in existKeys:\r
existKeys.append(Key)\r
else:\r
if Key not in existKeys:\r
existKeys.append(Key)\r
else:\r
if ret is not None:\r
Line = ret\r
fw.write(Line)\r
if ret is not None:\r
Line = ret\r
fw.write(Line)\r
- for key in self.TargetTxtDictionary.keys():\r
+ for key in self.TargetTxtDictionary:\r
if key not in existKeys:\r
print "Warning: %s does not exist in original configuration file" % key\r
Line = GetConfigureKeyValue(self, key)\r
if key not in existKeys:\r
print "Warning: %s does not exist in original configuration file" % key\r
Line = GetConfigureKeyValue(self, key)\r
self._Includes.append(self._SourceOverridePath)\r
\r
Macros = self._Macros\r
self._Includes.append(self._SourceOverridePath)\r
\r
Macros = self._Macros\r
- if 'PROCESSOR' in GlobalData.gEdkGlobal.keys():\r
- Macros['PROCESSOR'] = GlobalData.gEdkGlobal['PROCESSOR']\r
- else:\r
- Macros['PROCESSOR'] = self._Arch\r
+ Macros['PROCESSOR'] = GlobalData.gEdkGlobal.get('PROCESSOR', self._Arch)\r
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]\r
for Record in RecordList:\r
if Record[0].find('EDK_SOURCE') > -1:\r
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]\r
for Record in RecordList:\r
if Record[0].find('EDK_SOURCE') > -1:\r
# Allow using system environment variables in path after !include\r
#\r
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']\r
# Allow using system environment variables in path after !include\r
#\r
__IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']\r
- if "ECP_SOURCE" in GlobalData.gGlobalDefines.keys():\r
+ if "ECP_SOURCE" in GlobalData.gGlobalDefines:\r
__IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']\r
#\r
# During GenFds phase call DSC parser, will go into this branch.\r
#\r
__IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']\r
#\r
# During GenFds phase call DSC parser, will go into this branch.\r
#\r
- elif "ECP_SOURCE" in GlobalData.gCommandLineDefines.keys():\r
+ elif "ECP_SOURCE" in GlobalData.gCommandLineDefines:\r
__IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']\r
\r
__IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']\r
__IncludeMacros['ECP_SOURCE'] = GlobalData.gCommandLineDefines['ECP_SOURCE']\r
\r
__IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']\r
## @file\r
# Common routines used by workspace\r
#\r
## @file\r
# Common routines used by workspace\r
#\r
-# Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
PcdCName = Pcd[0]\r
PcdTokenName = Pcd[1]\r
if GlobalData.MixedPcd:\r
PcdCName = Pcd[0]\r
PcdTokenName = Pcd[1]\r
if GlobalData.MixedPcd:\r
- for PcdItem in GlobalData.MixedPcd.keys():\r
+ for PcdItem in GlobalData.MixedPcd:\r
if (PcdCName, PcdTokenName) in GlobalData.MixedPcd[PcdItem]:\r
PcdCName = PcdItem[0]\r
break\r
if (PcdCName, PcdTokenName) in GlobalData.MixedPcd[PcdItem]:\r
PcdCName = PcdItem[0]\r
break\r
- if (PcdCName, PcdTokenName) not in DecPcds.keys():\r
+ if (PcdCName, PcdTokenName) not in DecPcds:\r
DecPcds[PcdCName, PcdTokenName] = Pkg.Pcds[Pcd]\r
return DecPcds, GuidDict\r
\r
DecPcds[PcdCName, PcdTokenName] = Pkg.Pcds[Pcd]\r
return DecPcds, GuidDict\r
\r
for LibraryName in M.Libraries:\r
Library = Platform.LibraryClasses[LibraryName, ':dummy:']\r
if Library is None:\r
for LibraryName in M.Libraries:\r
Library = Platform.LibraryClasses[LibraryName, ':dummy:']\r
if Library is None:\r
- for Key in Platform.LibraryClasses.data.keys():\r
+ for Key in Platform.LibraryClasses.data:\r
if LibraryName.upper() == Key.upper():\r
Library = Platform.LibraryClasses[Key, ':dummy:']\r
break\r
if LibraryName.upper() == Key.upper():\r
Library = Platform.LibraryClasses[Key, ':dummy:']\r
break\r
for PcdItem in GlobalData.gConditionalPcds:\r
if '.' in PcdItem:\r
(TokenSpaceGuidCName, TokenCName) = PcdItem.split('.')\r
for PcdItem in GlobalData.gConditionalPcds:\r
if '.' in PcdItem:\r
(TokenSpaceGuidCName, TokenCName) = PcdItem.split('.')\r
- if (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds.keys():\r
+ if (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:\r
Pcd = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)]\r
PcdList = self.ConditionalPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])\r
if Pcd not in PcdList:\r
Pcd = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)]\r
PcdList = self.ConditionalPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])\r
if Pcd not in PcdList:\r
DscMatch = (DscDefaultValue.strip() == PcdValue.strip())\r
\r
IsStructure = False\r
DscMatch = (DscDefaultValue.strip() == PcdValue.strip())\r
\r
IsStructure = False\r
- if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd.keys()) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.gStructurePcd[self.Arch]):\r
+ if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.gStructurePcd[self.Arch]):\r
IsStructure = True\r
if TypeName in ('DYNVPD', 'DEXVPD'):\r
SkuInfoList = Pcd.SkuInfoList\r
IsStructure = True\r
if TypeName in ('DYNVPD', 'DEXVPD'):\r
SkuInfoList = Pcd.SkuInfoList\r
import Common.GlobalData as GlobalData\r
from GenFds.GenFds import GenFds\r
\r
import Common.GlobalData as GlobalData\r
from GenFds.GenFds import GenFds\r
\r
-from collections import OrderedDict\r
+from collections import OrderedDict,defaultdict\r
\r
# Version and Copyright\r
VersionNumber = "0.60" + ' ' + gBUILD_VERSION\r
\r
# Version and Copyright\r
VersionNumber = "0.60" + ' ' + gBUILD_VERSION\r
BuildTask._Thread.acquire(True)\r
\r
# start a new build thread\r
BuildTask._Thread.acquire(True)\r
\r
# start a new build thread\r
- Bo = BuildTask._ReadyQueue.keys()[0]\r
- Bt = BuildTask._ReadyQueue.pop(Bo)\r
+ Bo,Bt = BuildTask._ReadyQueue.popitem()\r
\r
# move into running queue\r
BuildTask._RunningQueueLock.acquire()\r
\r
# move into running queue\r
BuildTask._RunningQueueLock.acquire()\r
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = self.ToolChainList[0]\r
if self.ToolChainFamily:\r
GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]\r
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = self.ToolChainList[0]\r
if self.ToolChainFamily:\r
GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]\r
- if 'PREBUILD' in GlobalData.gCommandLineDefines.keys():\r
+ if 'PREBUILD' in GlobalData.gCommandLineDefines:\r
self.Prebuild = GlobalData.gCommandLineDefines.get('PREBUILD')\r
else:\r
self.Db.InitDatabase()\r
self.Prebuild = GlobalData.gCommandLineDefines.get('PREBUILD')\r
else:\r
self.Db.InitDatabase()\r
self.Prebuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList, self.PlatformFile, self.Target)\r
\r
def InitPostBuild(self):\r
self.Prebuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList, self.PlatformFile, self.Target)\r
\r
def InitPostBuild(self):\r
- if 'POSTBUILD' in GlobalData.gCommandLineDefines.keys():\r
+ if 'POSTBUILD' in GlobalData.gCommandLineDefines:\r
self.Postbuild = GlobalData.gCommandLineDefines.get('POSTBUILD')\r
else:\r
Platform = self.Db._MapPlatform(str(self.PlatformFile))\r
self.Postbuild = GlobalData.gCommandLineDefines.get('POSTBUILD')\r
else:\r
Platform = self.Db._MapPlatform(str(self.PlatformFile))\r
# First get the XIP base address for FV map file.\r
GuidPattern = re.compile("[-a-fA-F0-9]+")\r
GuidName = re.compile("\(GUID=[-a-fA-F0-9]+")\r
# First get the XIP base address for FV map file.\r
GuidPattern = re.compile("[-a-fA-F0-9]+")\r
GuidName = re.compile("\(GUID=[-a-fA-F0-9]+")\r
- for FvName in Wa.FdfProfile.FvDict.keys():\r
+ for FvName in Wa.FdfProfile.FvDict:\r
FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')\r
if not os.path.exists(FvMapBuffer):\r
continue\r
FvMapBuffer = os.path.join(Wa.FvDir, FvName + '.Fv.map')\r
if not os.path.exists(FvMapBuffer):\r
continue\r
self._SaveMapFile (MapBuffer, Wa)\r
\r
def _GenFfsCmd(self):\r
self._SaveMapFile (MapBuffer, Wa)\r
\r
def _GenFfsCmd(self):\r
+ # convert dictionary of Cmd:(Inf,Arch) \r
+ # to a new dictionary of (Inf,Arch):Cmd,Cmd,Cmd...\r
+ CmdSetDict = defaultdict(set)\r
GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, self.ArchList, GlobalData)\r
for Cmd in GenFfsDict:\r
tmpInf, tmpArch = GenFfsDict[Cmd]\r
GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, self.ArchList, GlobalData)\r
for Cmd in GenFfsDict:\r
tmpInf, tmpArch = GenFfsDict[Cmd]\r
- if (tmpInf, tmpArch) not in CmdListDict.keys():\r
- CmdListDict[tmpInf, tmpArch] = [Cmd]\r
- else:\r
- CmdListDict[tmpInf, tmpArch].append(Cmd)\r
- return CmdListDict\r
+ CmdSetDict[tmpInf, tmpArch].add(Cmd)\r
+ return CmdSetDict\r
\r
## Build a platform in multi-thread mode\r
#\r
\r
## Build a platform in multi-thread mode\r
#\r