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>
This commit is contained in:
committed by
Yonghong Zhu
parent
55c84777ee
commit
9eb87141ec
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# generate capsule
|
||||
#
|
||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 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
|
||||
@@ -201,7 +201,7 @@ class Capsule (CapsuleClassObject) :
|
||||
# @retval string Generated Capsule file path
|
||||
#
|
||||
def GenCapsule(self):
|
||||
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():
|
||||
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict:
|
||||
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']
|
||||
|
||||
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)
|
||||
@@ -251,11 +251,11 @@ class Capsule (CapsuleClassObject) :
|
||||
|
||||
CapInfFile.writelines("[options]" + T_CHAR_LF)
|
||||
|
||||
for Item in self.TokensDict.keys():
|
||||
for Item in self.TokensDict:
|
||||
CapInfFile.writelines("EFI_" + \
|
||||
Item + \
|
||||
' = ' + \
|
||||
self.TokensDict.get(Item) + \
|
||||
self.TokensDict[Item] + \
|
||||
T_CHAR_LF)
|
||||
|
||||
return CapInfFile
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# generate capsule
|
||||
#
|
||||
# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007-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
|
||||
@@ -80,8 +80,8 @@ class CapsuleFv (CapsuleData):
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
if self.FvName.find('.fv') == -1:
|
||||
if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
|
||||
if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[self.FvName.upper()]
|
||||
FdBuffer = StringIO.StringIO('')
|
||||
FvObj.CapsuleName = self.CapsuleName
|
||||
FvFile = FvObj.AddToBuffer(FdBuffer)
|
||||
@@ -112,8 +112,8 @@ class CapsuleFd (CapsuleData):
|
||||
#
|
||||
def GenCapsuleSubItem(self):
|
||||
if self.FdName.find('.fd') == -1:
|
||||
if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())
|
||||
if self.FdName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[self.FdName.upper()]
|
||||
FdFile = FdObj.GenFd()
|
||||
return FdFile
|
||||
else:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# process FD generation
|
||||
#
|
||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 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
|
||||
@@ -46,7 +46,7 @@ class FD(FDClassObject):
|
||||
# @retval string Generated FD file name
|
||||
#
|
||||
def GenFd (self, Flag = False):
|
||||
if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():
|
||||
if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict:
|
||||
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']
|
||||
|
||||
#
|
||||
|
@@ -3402,7 +3402,7 @@ class FdfParser:
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__Token.upper() not in self.Profile.FvDict.keys():
|
||||
if self.__Token.upper() not in self.Profile.FvDict:
|
||||
raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
CapsuleFv = CapsuleData.CapsuleFv()
|
||||
@@ -3436,7 +3436,7 @@ class FdfParser:
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__Token.upper() not in self.Profile.FdDict.keys():
|
||||
if self.__Token.upper() not in self.Profile.FdDict:
|
||||
raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
CapsuleFd = CapsuleData.CapsuleFd()
|
||||
@@ -4532,7 +4532,7 @@ class FdfParser:
|
||||
def __GetCapInFd (self, FdName):
|
||||
|
||||
CapList = []
|
||||
if FdName.upper() in self.Profile.FdDict.keys():
|
||||
if FdName.upper() in self.Profile.FdDict:
|
||||
FdObj = self.Profile.FdDict[FdName.upper()]
|
||||
for elementRegion in FdObj.RegionList:
|
||||
if elementRegion.RegionType == 'CAPSULE':
|
||||
@@ -4579,7 +4579,7 @@ class FdfParser:
|
||||
def __GetFvInFd (self, FdName):
|
||||
|
||||
FvList = []
|
||||
if FdName.upper() in self.Profile.FdDict.keys():
|
||||
if FdName.upper() in self.Profile.FdDict:
|
||||
FdObj = self.Profile.FdDict[FdName.upper()]
|
||||
for elementRegion in FdObj.RegionList:
|
||||
if elementRegion.RegionType == 'FV':
|
||||
@@ -4648,7 +4648,7 @@ class FdfParser:
|
||||
# Check the cycle between FV and FD image
|
||||
#
|
||||
MaxLength = len (self.Profile.FvDict)
|
||||
for FvName in self.Profile.FvDict.keys():
|
||||
for FvName in self.Profile.FvDict:
|
||||
LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName
|
||||
RefFvStack = []
|
||||
RefFvStack.append(FvName)
|
||||
@@ -4658,7 +4658,7 @@ class FdfParser:
|
||||
while RefFvStack != [] and Index < MaxLength:
|
||||
Index = Index + 1
|
||||
FvNameFromStack = RefFvStack.pop()
|
||||
if FvNameFromStack.upper() in self.Profile.FvDict.keys():
|
||||
if FvNameFromStack.upper() in self.Profile.FvDict:
|
||||
FvObj = self.Profile.FvDict[FvNameFromStack.upper()]
|
||||
else:
|
||||
continue
|
||||
@@ -4697,7 +4697,7 @@ class FdfParser:
|
||||
# Check the cycle between Capsule and FD image
|
||||
#
|
||||
MaxLength = len (self.Profile.CapsuleDict)
|
||||
for CapName in self.Profile.CapsuleDict.keys():
|
||||
for CapName in self.Profile.CapsuleDict:
|
||||
#
|
||||
# Capsule image to be checked.
|
||||
#
|
||||
@@ -4711,7 +4711,7 @@ class FdfParser:
|
||||
while RefCapStack != [] and Index < MaxLength:
|
||||
Index = Index + 1
|
||||
CapNameFromStack = RefCapStack.pop()
|
||||
if CapNameFromStack.upper() in self.Profile.CapsuleDict.keys():
|
||||
if CapNameFromStack.upper() in self.Profile.CapsuleDict:
|
||||
CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]
|
||||
else:
|
||||
continue
|
||||
@@ -4756,7 +4756,7 @@ class FdfParser:
|
||||
if RefFvName in FvAnalyzedList:
|
||||
continue
|
||||
LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)
|
||||
if RefFvName.upper() in self.Profile.FvDict.keys():
|
||||
if RefFvName.upper() in self.Profile.FvDict:
|
||||
FvObj = self.Profile.FvDict[RefFvName.upper()]
|
||||
else:
|
||||
continue
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# process FFS generation from FILE statement
|
||||
#
|
||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 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
|
||||
@@ -83,14 +83,14 @@ class FileStatement (FileStatementClassObject) :
|
||||
SectionAlignments = None
|
||||
if self.FvName is not None :
|
||||
Buffer = StringIO.StringIO('')
|
||||
if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))
|
||||
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
|
||||
FileName = Fv.AddToBuffer(Buffer)
|
||||
SectionFiles = [FileName]
|
||||
|
||||
elif self.FdName is not None:
|
||||
if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))
|
||||
Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())
|
||||
FileName = Fd.GenFd()
|
||||
|
@@ -613,7 +613,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
# the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,
|
||||
# but the path (self.MetaFile.Path) is the real path
|
||||
#
|
||||
for key in PlatformDataBase.Modules.keys():
|
||||
for key in PlatformDataBase.Modules:
|
||||
if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):
|
||||
DscArchList.append (Arch)
|
||||
break
|
||||
|
@@ -70,7 +70,7 @@ class FV (FvClassObject):
|
||||
#
|
||||
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :
|
||||
|
||||
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
|
||||
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict:
|
||||
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
|
||||
|
||||
#
|
||||
@@ -78,14 +78,13 @@ class FV (FvClassObject):
|
||||
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
|
||||
#
|
||||
if self.CapsuleName is not None:
|
||||
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
|
||||
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
|
||||
for RegionObj in FdObj.RegionList:
|
||||
if RegionObj.RegionType == 'FV':
|
||||
for RegionData in RegionObj.RegionDataList:
|
||||
if RegionData.endswith(".fv"):
|
||||
continue
|
||||
elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():
|
||||
elif RegionData.upper() + 'fv' in GenFds.ImageBinDict:
|
||||
continue
|
||||
elif self.UiFvName.upper() == RegionData.upper():
|
||||
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
|
||||
@@ -235,8 +234,7 @@ class FV (FvClassObject):
|
||||
if self.BlockSizeList:
|
||||
return True
|
||||
|
||||
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
|
||||
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
|
||||
for RegionObj in FdObj.RegionList:
|
||||
if RegionObj.RegionType != 'FV':
|
||||
continue
|
||||
@@ -441,7 +439,7 @@ class FV (FvClassObject):
|
||||
# Add [Files]
|
||||
#
|
||||
self.FvInfFile.writelines("[files]" + T_CHAR_LF)
|
||||
if VtfDict is not None and self.UiFvName in VtfDict.keys():
|
||||
if VtfDict is not None and self.UiFvName in VtfDict:
|
||||
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
|
||||
VtfDict.get(self.UiFvName) + \
|
||||
VtfDict[self.UiFvName] + \
|
||||
T_CHAR_LF)
|
||||
|
@@ -92,7 +92,7 @@ def main():
|
||||
else:
|
||||
Workspace = os.path.normcase(Options.Workspace)
|
||||
GenFdsGlobalVariable.WorkSpaceDir = Workspace
|
||||
if 'EDK_SOURCE' in os.environ.keys():
|
||||
if 'EDK_SOURCE' in os.environ:
|
||||
GenFdsGlobalVariable.EdkSourceDir = os.path.normcase(os.environ['EDK_SOURCE'])
|
||||
if (Options.debug):
|
||||
GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace)
|
||||
@@ -156,7 +156,7 @@ def main():
|
||||
# This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
|
||||
ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath)
|
||||
else:
|
||||
if "CONF_PATH" in os.environ.keys():
|
||||
if "CONF_PATH" in os.environ:
|
||||
ConfDirectoryPath = os.path.normcase(os.environ["CONF_PATH"])
|
||||
else:
|
||||
# Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf
|
||||
@@ -216,11 +216,11 @@ def main():
|
||||
os.environ["WORKSPACE"] = Workspace
|
||||
|
||||
# Use the -t and -b option as gGlobalDefines's TOOLCHAIN and TARGET if they are not defined
|
||||
if "TARGET" not in GlobalData.gGlobalDefines.keys():
|
||||
if "TARGET" not in GlobalData.gGlobalDefines:
|
||||
GlobalData.gGlobalDefines["TARGET"] = GenFdsGlobalVariable.TargetName
|
||||
if "TOOLCHAIN" not in GlobalData.gGlobalDefines.keys():
|
||||
if "TOOLCHAIN" not in GlobalData.gGlobalDefines:
|
||||
GlobalData.gGlobalDefines["TOOLCHAIN"] = GenFdsGlobalVariable.ToolChainTag
|
||||
if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines.keys():
|
||||
if "TOOL_CHAIN_TAG" not in GlobalData.gGlobalDefines:
|
||||
GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = GenFdsGlobalVariable.ToolChainTag
|
||||
|
||||
"""call Workspace build create database"""
|
||||
@@ -278,21 +278,21 @@ def main():
|
||||
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
|
||||
|
||||
if (Options.uiFdName) :
|
||||
if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():
|
||||
if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict:
|
||||
GenFds.OnlyGenerateThisFd = Options.uiFdName
|
||||
else:
|
||||
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
|
||||
"No such an FD in FDF file: %s" % Options.uiFdName)
|
||||
|
||||
if (Options.uiFvName) :
|
||||
if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():
|
||||
if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict:
|
||||
GenFds.OnlyGenerateThisFv = Options.uiFvName
|
||||
else:
|
||||
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
|
||||
"No such an FV in FDF file: %s" % Options.uiFvName)
|
||||
|
||||
if (Options.uiCapName) :
|
||||
if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict.keys():
|
||||
if Options.uiCapName.upper() in FdfParserObj.Profile.CapsuleDict:
|
||||
GenFds.OnlyGenerateThisCap = Options.uiCapName
|
||||
else:
|
||||
EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
|
||||
@@ -388,7 +388,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
||||
KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)
|
||||
|
||||
if GenFdsGlobalVariable.GuidToolDefinition:
|
||||
if NameGuid in GenFdsGlobalVariable.GuidToolDefinition.keys():
|
||||
if NameGuid in GenFdsGlobalVariable.GuidToolDefinition:
|
||||
return GenFdsGlobalVariable.GuidToolDefinition[NameGuid]
|
||||
|
||||
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
|
||||
@@ -450,10 +450,10 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
|
||||
if Key in KeyStringList and KeyList[4] == 'GUID':
|
||||
ToolPathKey = Key + '_' + KeyList[3] + '_PATH'
|
||||
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
|
||||
if ToolPathKey in BuildOption.keys():
|
||||
ToolPathTmp = BuildOption.get(ToolPathKey)
|
||||
if ToolOptionKey in BuildOption.keys():
|
||||
ToolOption = BuildOption.get(ToolOptionKey)
|
||||
if ToolPathKey in BuildOption:
|
||||
ToolPathTmp = BuildOption[ToolPathKey]
|
||||
if ToolOptionKey in BuildOption:
|
||||
ToolOption = BuildOption[ToolOptionKey]
|
||||
|
||||
GenFdsGlobalVariable.GuidToolDefinition[NameGuid] = (ToolPathTmp, ToolOption)
|
||||
return ToolPathTmp, ToolOption
|
||||
@@ -522,63 +522,56 @@ class GenFds :
|
||||
GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)
|
||||
|
||||
GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")
|
||||
if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
|
||||
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.get(GenFds.OnlyGenerateThisCap.upper())
|
||||
if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:
|
||||
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[GenFds.OnlyGenerateThisCap.upper()]
|
||||
if CapsuleObj is not None:
|
||||
CapsuleObj.GenCapsule()
|
||||
return
|
||||
|
||||
if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())
|
||||
if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
|
||||
if FdObj is not None:
|
||||
FdObj.GenFd()
|
||||
return
|
||||
elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:
|
||||
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
|
||||
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
|
||||
FdObj.GenFd()
|
||||
|
||||
GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")
|
||||
if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())
|
||||
if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[GenFds.OnlyGenerateThisFv.upper()]
|
||||
if FvObj is not None:
|
||||
Buffer = StringIO.StringIO()
|
||||
FvObj.AddToBuffer(Buffer)
|
||||
Buffer.close()
|
||||
return
|
||||
elif GenFds.OnlyGenerateThisFv is None:
|
||||
for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():
|
||||
Buffer = StringIO.StringIO('')
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
|
||||
FvObj.AddToBuffer(Buffer)
|
||||
Buffer.close()
|
||||
|
||||
if GenFds.OnlyGenerateThisFv is None and GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisCap is None:
|
||||
if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:
|
||||
GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")
|
||||
for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
|
||||
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName]
|
||||
for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.values():
|
||||
CapsuleObj.GenCapsule()
|
||||
|
||||
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
|
||||
GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")
|
||||
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
|
||||
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
|
||||
for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():
|
||||
OptRomObj.AddToBuffer(None)
|
||||
@staticmethod
|
||||
def GenFfsMakefile(OutputDir, FdfParser, WorkSpace, ArchList, GlobalData):
|
||||
GenFdsGlobalVariable.SetEnv(FdfParser, WorkSpace, ArchList, GlobalData)
|
||||
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
|
||||
for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
|
||||
FdObj.GenFd(Flag=True)
|
||||
|
||||
for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
|
||||
for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict.values():
|
||||
FvObj.AddToBuffer(Buffer=None, Flag=True)
|
||||
|
||||
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
|
||||
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
|
||||
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
|
||||
for OptRomObj in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.values():
|
||||
OptRomObj.AddToBuffer(Buffer=None, Flag=True)
|
||||
|
||||
return GenFdsGlobalVariable.FfsCmdDict
|
||||
@@ -591,7 +584,7 @@ class GenFds :
|
||||
def GetFvBlockSize(FvObj):
|
||||
DefaultBlockSize = 0x1
|
||||
FdObj = None
|
||||
if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
|
||||
if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict:
|
||||
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
|
||||
if FdObj is None:
|
||||
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
|
||||
|
@@ -549,7 +549,7 @@ class GenFdsGlobalVariable:
|
||||
|
||||
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
|
||||
if MakefilePath:
|
||||
if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict.keys():
|
||||
if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:
|
||||
GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath
|
||||
GenFdsGlobalVariable.SecCmdList = []
|
||||
GenFdsGlobalVariable.CopyList = []
|
||||
@@ -779,7 +779,7 @@ class GenFdsGlobalVariable:
|
||||
if MacroDict is not None and len (MacroDict) != 0:
|
||||
Dict.update(MacroDict)
|
||||
|
||||
for key in Dict.keys():
|
||||
for key in Dict:
|
||||
if Str.find(key) >= 0 :
|
||||
Str = Str.replace (key, Dict[key])
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# process FD Region generation
|
||||
#
|
||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 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
|
||||
@@ -102,7 +102,7 @@ class Region(RegionClassObject):
|
||||
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
|
||||
|
||||
FileName = RegionData
|
||||
elif RegionData.upper() + 'fv' in ImageBinDict.keys():
|
||||
elif RegionData.upper() + 'fv' in ImageBinDict:
|
||||
if not Flag:
|
||||
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
|
||||
FileName = ImageBinDict[RegionData.upper() + 'fv']
|
||||
@@ -111,8 +111,8 @@ class Region(RegionClassObject):
|
||||
# Generate FvImage.
|
||||
#
|
||||
FvObj = None
|
||||
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
|
||||
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict:
|
||||
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[RegionData.upper()]
|
||||
|
||||
if FvObj is not None :
|
||||
if not Flag:
|
||||
@@ -182,7 +182,7 @@ class Region(RegionClassObject):
|
||||
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
|
||||
|
||||
FileName = RegionData
|
||||
elif RegionData.upper() + 'cap' in ImageBinDict.keys():
|
||||
elif RegionData.upper() + 'cap' in ImageBinDict:
|
||||
GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
|
||||
FileName = ImageBinDict[RegionData.upper() + 'cap']
|
||||
else:
|
||||
@@ -190,7 +190,7 @@ class Region(RegionClassObject):
|
||||
# Generate Capsule image and Put it into FD buffer
|
||||
#
|
||||
CapsuleObj = None
|
||||
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
|
||||
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict:
|
||||
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]
|
||||
|
||||
if CapsuleObj is not None :
|
||||
|
Reference in New Issue
Block a user