BaseTools: Adjust the spaces around commas and colons
Based on "futurize -f lib2to3.fixes.fix_ws_comma" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import FfsFileStatement
|
||||
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
from CommonDataClass.FdfClass import AprioriSectionClassObject
|
||||
from Common.StringUtils import *
|
||||
from Common.Misc import SaveFileOnChange,PathClass
|
||||
from Common.Misc import SaveFileOnChange, PathClass
|
||||
from Common import EdkLogger
|
||||
from Common.BuildToolError import *
|
||||
from Common.DataType import TAB_COMMON
|
||||
|
@@ -207,7 +207,7 @@ class CapsulePayload(CapsuleData):
|
||||
#
|
||||
Guid = self.ImageTypeId.split('-')
|
||||
Buffer = pack('=ILHHBBBBBBBBBBBBIIQ',
|
||||
int(self.Version,16),
|
||||
int(self.Version, 16),
|
||||
int(Guid[0], 16),
|
||||
int(Guid[1], 16),
|
||||
int(Guid[2], 16),
|
||||
|
@@ -133,7 +133,7 @@ class EfiSection (EfiSectionClassObject):
|
||||
elif FileList != []:
|
||||
for File in FileList:
|
||||
Index = Index + 1
|
||||
Num = '%s.%d' %(SecNum , Index)
|
||||
Num = '%s.%d' %(SecNum, Index)
|
||||
OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
|
||||
f = open(File, 'r')
|
||||
VerString = f.read()
|
||||
@@ -192,7 +192,7 @@ class EfiSection (EfiSectionClassObject):
|
||||
elif FileList != []:
|
||||
for File in FileList:
|
||||
Index = Index + 1
|
||||
Num = '%s.%d' %(SecNum , Index)
|
||||
Num = '%s.%d' %(SecNum, Index)
|
||||
OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
|
||||
f = open(File, 'r')
|
||||
UiString = f.read()
|
||||
@@ -237,7 +237,7 @@ class EfiSection (EfiSectionClassObject):
|
||||
for File in FileList:
|
||||
""" Copy Map file to FFS output path """
|
||||
Index = Index + 1
|
||||
Num = '%s.%d' %(SecNum , Index)
|
||||
Num = '%s.%d' %(SecNum, Index)
|
||||
OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))
|
||||
File = GenFdsGlobalVariable.MacroExtend(File, Dict)
|
||||
|
||||
|
@@ -137,7 +137,7 @@ class FD(FDClassObject):
|
||||
# Call each region's AddToBuffer function
|
||||
#
|
||||
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
|
||||
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict,Flag=Flag)
|
||||
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict, Flag=Flag)
|
||||
#
|
||||
# Write the buffer contents to Fd file
|
||||
#
|
||||
@@ -163,7 +163,7 @@ class FD(FDClassObject):
|
||||
if len(RegionObj.RegionDataList) == 1:
|
||||
RegionData = RegionObj.RegionDataList[0]
|
||||
FvList.append(RegionData.upper())
|
||||
FvAddDict[RegionData.upper()] = (int(self.BaseAddress,16) + \
|
||||
FvAddDict[RegionData.upper()] = (int(self.BaseAddress, 16) + \
|
||||
RegionObj.Offset, RegionObj.Size)
|
||||
else:
|
||||
Offset = RegionObj.Offset
|
||||
@@ -178,7 +178,7 @@ class FD(FDClassObject):
|
||||
Size = 0
|
||||
for blockStatement in FvObj.BlockSizeList:
|
||||
Size = Size + blockStatement[0] * blockStatement[1]
|
||||
FvAddDict[RegionData.upper()] = (int(self.BaseAddress,16) + \
|
||||
FvAddDict[RegionData.upper()] = (int(self.BaseAddress, 16) + \
|
||||
Offset, Size)
|
||||
Offset = Offset + Size
|
||||
#
|
||||
|
@@ -1820,7 +1820,7 @@ class FdfParser:
|
||||
return long(
|
||||
ValueExpression(Expr,
|
||||
self.__CollectMacroPcd()
|
||||
)(True),0)
|
||||
)(True), 0)
|
||||
except Exception:
|
||||
self.SetFileBufferPos(StartPos)
|
||||
return None
|
||||
@@ -2730,7 +2730,7 @@ class FdfParser:
|
||||
while True:
|
||||
AlignValue = None
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
#For FFS, Auto is default option same to ""
|
||||
@@ -2789,7 +2789,7 @@ class FdfParser:
|
||||
FfsFileObj.CheckSum = True
|
||||
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
#For FFS, Auto is default option same to ""
|
||||
@@ -2861,7 +2861,7 @@ class FdfParser:
|
||||
|
||||
AlignValue = None
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
AlignValue = self.__Token
|
||||
@@ -3151,7 +3151,7 @@ class FdfParser:
|
||||
|
||||
AlignValue = None
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
AlignValue = self.__Token
|
||||
@@ -3544,7 +3544,7 @@ class FdfParser:
|
||||
AfileName = self.__Token
|
||||
AfileBaseName = os.path.basename(AfileName)
|
||||
|
||||
if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin",".dat",".DAT",".Dat",".data",".DATA",".Data"]:
|
||||
if os.path.splitext(AfileBaseName)[1] not in [".bin", ".BIN", ".Bin", ".dat", ".DAT", ".Dat", ".data", ".DATA", ".Data"]:
|
||||
raise Warning('invalid binary file type, should be one of "bin",BINARY_FILE_TYPE_BIN,"Bin","dat","DAT","Dat","data","DATA","Data"', \
|
||||
self.FileName, self.CurrentLineNumber)
|
||||
|
||||
@@ -3741,7 +3741,7 @@ class FdfParser:
|
||||
|
||||
AlignValue = ""
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
#For FFS, Auto is default option same to ""
|
||||
@@ -3791,7 +3791,7 @@ class FdfParser:
|
||||
|
||||
SectAlignment = ""
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
|
||||
@@ -3871,7 +3871,7 @@ class FdfParser:
|
||||
FvImageSectionObj.FvFileType = self.__Token
|
||||
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
FvImageSectionObj.Alignment = self.__Token
|
||||
@@ -3939,7 +3939,7 @@ class FdfParser:
|
||||
EfiSectionObj.BuildNum = self.__Token
|
||||
|
||||
if self.__GetAlignment():
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",
|
||||
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K", "64K", "128K",
|
||||
"256K", "512K", "1M", "2M", "4M", "8M", "16M"):
|
||||
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
|
||||
if self.__Token == 'Auto' and (not SectionName == BINARY_FILE_TYPE_PE32) and (not SectionName == BINARY_FILE_TYPE_TE):
|
||||
@@ -4679,7 +4679,7 @@ class FdfParser:
|
||||
FvInFdList = self.__GetFvInFd(RefFdName)
|
||||
if FvInFdList != []:
|
||||
for FvNameInFd in FvInFdList:
|
||||
LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)
|
||||
LogStr += "FD %s contains FV %s\n" % (RefFdName, FvNameInFd)
|
||||
if FvNameInFd not in RefFvStack:
|
||||
RefFvStack.append(FvNameInFd)
|
||||
|
||||
@@ -4735,7 +4735,7 @@ class FdfParser:
|
||||
CapInFdList = self.__GetCapInFd(RefFdName)
|
||||
if CapInFdList != []:
|
||||
for CapNameInFd in CapInFdList:
|
||||
LogStr += "FD %s contains Capsule %s\n" % (RefFdName,CapNameInFd)
|
||||
LogStr += "FD %s contains Capsule %s\n" % (RefFdName, CapNameInFd)
|
||||
if CapNameInFd not in RefCapStack:
|
||||
RefCapStack.append(CapNameInFd)
|
||||
|
||||
@@ -4746,7 +4746,7 @@ class FdfParser:
|
||||
FvInFdList = self.__GetFvInFd(RefFdName)
|
||||
if FvInFdList != []:
|
||||
for FvNameInFd in FvInFdList:
|
||||
LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)
|
||||
LogStr += "FD %s contains FV %s\n" % (RefFdName, FvNameInFd)
|
||||
if FvNameInFd not in RefFvList:
|
||||
RefFvList.append(FvNameInFd)
|
||||
|
||||
|
@@ -293,7 +293,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
try:
|
||||
Pcd.InfDefaultValue = ValueExpressionEx(Pcd.InfDefaultValue, Pcd.DatumType, Platform._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue), File=self.InfFileName)
|
||||
|
||||
# Check value, if value are equal, no need to patch
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
@@ -446,7 +446,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
|
||||
self.__InfParse__(Dict)
|
||||
Arch = self.GetCurrentArch()
|
||||
SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName);
|
||||
SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName);
|
||||
DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')
|
||||
|
||||
SrcFileDir = "."
|
||||
@@ -694,13 +694,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
Arch = self.CurrentArch
|
||||
|
||||
OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
|
||||
Arch ,
|
||||
Arch,
|
||||
ModulePath,
|
||||
FileName,
|
||||
'OUTPUT'
|
||||
)
|
||||
DebugPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
|
||||
Arch ,
|
||||
Arch,
|
||||
ModulePath,
|
||||
FileName,
|
||||
'DEBUG'
|
||||
@@ -962,9 +962,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
Sect.FvParentAddr = FvParentAddr
|
||||
|
||||
if Rule.KeyStringList != []:
|
||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self, IsMakefile = IsMakefile)
|
||||
SectList, Align = Sect.GenSection(self.OutputPath, self.ModuleGuid, SecIndex, Rule.KeyStringList, self, IsMakefile = IsMakefile)
|
||||
else :
|
||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self, IsMakefile = IsMakefile)
|
||||
SectList, Align = Sect.GenSection(self.OutputPath, self.ModuleGuid, SecIndex, self.KeyStringList, self, IsMakefile = IsMakefile)
|
||||
|
||||
if not HasGeneratedFlag:
|
||||
UniVfrOffsetFileSection = ""
|
||||
@@ -1121,7 +1121,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
try :
|
||||
SaveFileOnChange(UniVfrOffsetFileName, fStringIO.getvalue())
|
||||
except:
|
||||
EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName,None)
|
||||
EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName, None)
|
||||
|
||||
fStringIO.close ()
|
||||
|
||||
|
@@ -379,8 +379,8 @@ class FV (FvClassObject):
|
||||
# check if the file path exists or not
|
||||
if not os.path.isfile(FileFullPath):
|
||||
GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))
|
||||
FvExtFile = open (FileFullPath,'rb')
|
||||
FvExtFile.seek(0,2)
|
||||
FvExtFile = open (FileFullPath, 'rb')
|
||||
FvExtFile.seek(0, 2)
|
||||
Size = FvExtFile.tell()
|
||||
if Size >= 0x10000:
|
||||
GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index]))
|
||||
|
@@ -65,7 +65,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||
for FvFileName in FileList:
|
||||
FvAlignmentValue = 0
|
||||
if os.path.isfile(FvFileName):
|
||||
FvFileObj = open (FvFileName,'rb')
|
||||
FvFileObj = open (FvFileName, 'rb')
|
||||
FvFileObj.seek(0)
|
||||
# PI FvHeader is 0x48 byte
|
||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||
@@ -113,7 +113,7 @@ class FvImageSection(FvImageSectionClassObject):
|
||||
if self.FvFileName is not None:
|
||||
FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName)
|
||||
if os.path.isfile(FvFileName):
|
||||
FvFileObj = open (FvFileName,'rb')
|
||||
FvFileObj = open (FvFileName, 'rb')
|
||||
FvFileObj.seek(0)
|
||||
# PI FvHeader is 0x48 byte
|
||||
FvHeaderBuffer = FvFileObj.read(0x48)
|
||||
|
@@ -341,7 +341,7 @@ class GenFdsGlobalVariable:
|
||||
for Arch in ArchList:
|
||||
GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(
|
||||
os.path.join(GlobalData.gWorkspace,
|
||||
WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,GlobalData.gGlobalDefines['TARGET'],
|
||||
WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],
|
||||
GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory,
|
||||
GlobalData.gGlobalDefines['TARGET'] +'_' + GlobalData.gGlobalDefines['TOOLCHAIN']))
|
||||
GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = os.path.normpath(
|
||||
@@ -547,7 +547,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:
|
||||
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 = []
|
||||
|
Reference in New Issue
Block a user