summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds
diff options
context:
space:
mode:
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>2018-03-27 04:25:43 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-03-30 08:25:13 +0800
commit4231a8193ec0d52df7e0a101d96c51b1a2b7a996 (patch)
tree4fc8e46c9d51a4938e891e6b029781f1b66537ae /BaseTools/Source/Python/GenFds
parent05a32984ab799a564e2eeb7dff128fe0992910d8 (diff)
downloadedk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.gz
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.tar.bz2
edk2-4231a8193ec0d52df7e0a101d96c51b1a2b7a996.zip
BaseTools: Remove equality operator with None
replace "== None" with "is None" and "!= None" with "is not None" Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r--BaseTools/Source/Python/GenFds/AprioriSection.py4
-rw-r--r--BaseTools/Source/Python/GenFds/Capsule.py2
-rw-r--r--BaseTools/Source/Python/GenFds/CompressSection.py8
-rw-r--r--BaseTools/Source/Python/GenFds/DataSection.py4
-rw-r--r--BaseTools/Source/Python/GenFds/DepexSection.py2
-rw-r--r--BaseTools/Source/Python/GenFds/EfiSection.py26
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py50
-rw-r--r--BaseTools/Source/Python/GenFds/FfsFileStatement.py12
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py48
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py32
-rw-r--r--BaseTools/Source/Python/GenFds/FvImageSection.py12
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py46
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py28
-rw-r--r--BaseTools/Source/Python/GenFds/GuidSection.py30
-rw-r--r--BaseTools/Source/Python/GenFds/OptRomFileStatement.py2
-rw-r--r--BaseTools/Source/Python/GenFds/OptRomInfStatement.py16
-rw-r--r--BaseTools/Source/Python/GenFds/OptionRom.py4
-rw-r--r--BaseTools/Source/Python/GenFds/Region.py10
-rw-r--r--BaseTools/Source/Python/GenFds/Section.py8
-rw-r--r--BaseTools/Source/Python/GenFds/UiSection.py6
-rw-r--r--BaseTools/Source/Python/GenFds/VerSection.py6
-rw-r--r--BaseTools/Source/Python/GenFds/Vtf.py4
22 files changed, 180 insertions, 180 deletions
diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/Source/Python/GenFds/AprioriSection.py
index 70e2e5a3ba..92a74670ed 100644
--- a/BaseTools/Source/Python/GenFds/AprioriSection.py
+++ b/BaseTools/Source/Python/GenFds/AprioriSection.py
@@ -75,11 +75,11 @@ class AprioriSection (AprioriSectionClassObject):
InfFileName = NormPath(FfsObj.InfFileName)
Arch = FfsObj.GetCurrentArch()
- if Arch != None:
+ if Arch is not None:
Dict['$(ARCH)'] = Arch
InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)
- if Arch != None:
+ if Arch is not None:
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
Guid = Inf.Guid
diff --git a/BaseTools/Source/Python/GenFds/Capsule.py b/BaseTools/Source/Python/GenFds/Capsule.py
index e03d789957..9332f016f7 100644
--- a/BaseTools/Source/Python/GenFds/Capsule.py
+++ b/BaseTools/Source/Python/GenFds/Capsule.py
@@ -159,7 +159,7 @@ class Capsule (CapsuleClassObject) :
if not os.path.isabs(fmp.ImageFile):
CapInputFile = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, fmp.ImageFile)
CapOutputTmp = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName) + '.tmp'
- if ExternalTool == None:
+ if ExternalTool is None:
EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % fmp.Certificate_Guid)
else:
CmdOption += ExternalTool
diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py
index 56e71a3545..08ab48669f 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -55,7 +55,7 @@ class CompressSection (CompressSectionClassObject) :
#
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):
- if FfsInf != None:
+ if FfsInf is not None:
self.CompType = FfsInf.__ExtendMacro__(self.CompType)
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
@@ -67,13 +67,13 @@ class CompressSection (CompressSectionClassObject) :
Index = Index + 1
SecIndex = '%s.%d' %(SecNum, Index)
ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)
- if AlignValue != None:
- if MaxAlign == None:
+ if AlignValue is not None:
+ if MaxAlign is None:
MaxAlign = AlignValue
if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
MaxAlign = AlignValue
if ReturnSectList != []:
- if AlignValue == None:
+ if AlignValue is None:
AlignValue = "1"
for FileData in ReturnSectList:
SectFiles += (FileData,)
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py
index 2d2975f75c..40e345eee7 100644
--- a/BaseTools/Source/Python/GenFds/DataSection.py
+++ b/BaseTools/Source/Python/GenFds/DataSection.py
@@ -52,7 +52,7 @@ class DataSection (DataSectionClassObject):
#
# Prepare the parameter of GenSection
#
- if FfsFile != None:
+ if FfsFile is not None:
self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)
self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict, FfsFile.CurrentArch)
else:
@@ -92,7 +92,7 @@ class DataSection (DataSectionClassObject):
NoStrip = True
if self.SecType in ('TE', 'PE32'):
- if self.KeepReloc != None:
+ if self.KeepReloc is not None:
NoStrip = self.KeepReloc
if not NoStrip:
diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py
index 1992d2abd8..ef30a2f083 100644
--- a/BaseTools/Source/Python/GenFds/DepexSection.py
+++ b/BaseTools/Source/Python/GenFds/DepexSection.py
@@ -86,7 +86,7 @@ class DepexSection (DepexSectionClassObject):
for Exp in ExpList:
if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):
GuidStr = self.__FindGuidValue(Exp)
- if GuidStr == None:
+ if GuidStr is None:
EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,
"Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index 5029ec7a18..7e6c88a059 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -55,10 +55,10 @@ class EfiSection (EfiSectionClassObject):
#
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False) :
- if self.FileName != None and self.FileName.startswith('PCD('):
+ if self.FileName is not None and self.FileName.startswith('PCD('):
self.FileName = GenFdsGlobalVariable.GetPcdValue(self.FileName)
"""Prepare the parameter of GenSection"""
- if FfsInf != None :
+ if FfsInf is not None :
InfFileName = FfsInf.InfFileName
SectionType = FfsInf.__ExtendMacro__(self.SectionType)
Filename = FfsInf.__ExtendMacro__(self.FileName)
@@ -66,20 +66,20 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
NoStrip = True
if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):
- if FfsInf.KeepReloc != None:
+ if FfsInf.KeepReloc is not None:
NoStrip = FfsInf.KeepReloc
- elif FfsInf.KeepRelocFromRule != None:
+ elif FfsInf.KeepRelocFromRule is not None:
NoStrip = FfsInf.KeepRelocFromRule
- elif self.KeepReloc != None:
+ elif self.KeepReloc is not None:
NoStrip = self.KeepReloc
- elif FfsInf.ShadowFromInfFile != None:
+ elif FfsInf.ShadowFromInfFile is not None:
NoStrip = FfsInf.ShadowFromInfFile
else:
EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s apply rule for None!" %ModuleName)
"""If the file name was pointed out, add it in FileList"""
FileList = []
- if Filename != None:
+ if Filename is not None:
Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)
# check if the path is absolute or relative
if os.path.isabs(Filename):
@@ -107,14 +107,14 @@ class EfiSection (EfiSectionClassObject):
if SectionType == 'VERSION':
InfOverrideVerString = False
- if FfsInf.Version != None:
+ if FfsInf.Version is not None:
#StringData = FfsInf.Version
BuildNum = FfsInf.Version
InfOverrideVerString = True
if InfOverrideVerString:
#VerTuple = ('-n', '"' + StringData + '"')
- if BuildNum != None and BuildNum != '':
+ if BuildNum is not None and BuildNum != '':
BuildNumTuple = ('-j', BuildNum)
else:
BuildNumTuple = tuple()
@@ -136,7 +136,7 @@ class EfiSection (EfiSectionClassObject):
VerString = f.read()
f.close()
BuildNum = VerString
- if BuildNum != None and BuildNum != '':
+ if BuildNum is not None and BuildNum != '':
BuildNumTuple = ('-j', BuildNum)
GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',
#Ui=VerString,
@@ -146,7 +146,7 @@ class EfiSection (EfiSectionClassObject):
else:
BuildNum = StringData
- if BuildNum != None and BuildNum != '':
+ if BuildNum is not None and BuildNum != '':
BuildNumTuple = ('-j', BuildNum)
else:
BuildNumTuple = tuple()
@@ -173,7 +173,7 @@ class EfiSection (EfiSectionClassObject):
elif SectionType == 'UI':
InfOverrideUiString = False
- if FfsInf.Ui != None:
+ if FfsInf.Ui is not None:
StringData = FfsInf.Ui
InfOverrideUiString = True
@@ -196,7 +196,7 @@ class EfiSection (EfiSectionClassObject):
Ui=UiString, IsMakefile=IsMakefile)
OutputFileList.append(OutputFile)
else:
- if StringData != None and len(StringData) > 0:
+ if StringData is not None and len(StringData) > 0:
UiTuple = ('-n', '"' + StringData + '"')
else:
UiTuple = tuple()
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 9903e9570c..8a894f1528 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -639,7 +639,7 @@ class FdfParser:
if not MacroVal:
if Macro in MacroDict:
MacroVal = MacroDict[Macro]
- if MacroVal != None:
+ if MacroVal is not None:
IncFileName = IncFileName.replace('$(' + Macro + ')', MacroVal, 1)
if MacroVal.find('$(') != -1:
PreIndex = StartPos
@@ -687,7 +687,7 @@ class FdfParser:
# list index of the insertion, note that line number is 'CurrentLine + 1'
InsertAtLine = CurrentLine
ParentProfile = GetParentAtLine (CurrentLine)
- if ParentProfile != None:
+ if ParentProfile is not None:
ParentProfile.IncludeFileList.insert(0, IncFileProfile)
IncFileProfile.Level = ParentProfile.Level + 1
IncFileProfile.InsertStartLineNumber = InsertAtLine + 1
@@ -763,7 +763,7 @@ class FdfParser:
while StartPos != -1 and EndPos != -1 and self.__Token not in ['!ifdef', '!ifndef', '!if', '!elseif']:
MacroName = CurLine[StartPos+2 : EndPos]
MacorValue = self.__GetMacroValue(MacroName)
- if MacorValue != None:
+ if MacorValue is not None:
CurLine = CurLine.replace('$(' + MacroName + ')', MacorValue, 1)
if MacorValue.find('$(') != -1:
PreIndex = StartPos
@@ -1136,7 +1136,7 @@ class FdfParser:
if not self.__GetNextToken():
return False
- if gGuidPattern.match(self.__Token) != None:
+ if gGuidPattern.match(self.__Token) is not None:
return True
else:
self.__UndoToken()
@@ -1412,7 +1412,7 @@ class FdfParser:
#'\n\tGot Token: \"%s\" from File %s\n' % (self.__Token, FileLineTuple[0]) + \
# At this point, the closest parent would be the included file itself
Profile = GetParentAtLine(X.OriginalLineNumber)
- if Profile != None:
+ if Profile is not None:
X.Message += ' near line %d, column %d: %s' \
% (X.LineNumber, 0, Profile.FileLinesList[X.LineNumber-1])
else:
@@ -1540,7 +1540,7 @@ class FdfParser:
while self.__GetTokenStatements(FdObj):
pass
for Attr in ("BaseAddress", "Size", "ErasePolarity"):
- if getattr(FdObj, Attr) == None:
+ if getattr(FdObj, Attr) is None:
self.__GetNextToken()
raise Warning("Keyword %s missing" % Attr, self.FileName, self.CurrentLineNumber)
@@ -1695,7 +1695,7 @@ class FdfParser:
IsBlock = True
Item = Obj.BlockSizeList[-1]
- if Item[0] == None or Item[1] == None:
+ if Item[0] is None or Item[1] is None:
raise Warning("expected block statement", self.FileName, self.CurrentLineNumber)
return IsBlock
@@ -1863,7 +1863,7 @@ class FdfParser:
#
def __GetRegionLayout(self, Fd):
Offset = self.__CalcRegionExpr()
- if Offset == None:
+ if Offset is None:
return False
RegionObj = Region.Region()
@@ -1874,7 +1874,7 @@ class FdfParser:
raise Warning("expected '|'", self.FileName, self.CurrentLineNumber)
Size = self.__CalcRegionExpr()
- if Size == None:
+ if Size is None:
raise Warning("expected Region Size", self.FileName, self.CurrentLineNumber)
RegionObj.Size = Size
@@ -2974,7 +2974,7 @@ class FdfParser:
FvImageSectionObj = FvImageSection.FvImageSection()
FvImageSectionObj.Alignment = AlignValue
- if FvObj != None:
+ if FvObj is not None:
FvImageSectionObj.Fv = FvObj
FvImageSectionObj.FvName = None
else:
@@ -3791,7 +3791,7 @@ class FdfParser:
Rule.CheckSum = CheckSum
Rule.Fixed = Fixed
Rule.KeyStringList = KeyStringList
- if KeepReloc != None:
+ if KeepReloc is not None:
Rule.KeepReloc = KeepReloc
while True:
@@ -3847,7 +3847,7 @@ class FdfParser:
Rule.CheckSum = CheckSum
Rule.Fixed = Fixed
Rule.KeyStringList = KeyStringList
- if KeepReloc != None:
+ if KeepReloc is not None:
Rule.KeepReloc = KeepReloc
Rule.FileExtension = Ext
Rule.FileName = self.__Token
@@ -3986,7 +3986,7 @@ class FdfParser:
EfiSectionObj.KeepReloc = False
else:
EfiSectionObj.KeepReloc = True
- if Obj.KeepReloc != None and Obj.KeepReloc != EfiSectionObj.KeepReloc:
+ if Obj.KeepReloc is not None and Obj.KeepReloc != EfiSectionObj.KeepReloc:
raise Warning("Section type %s has reloc strip flag conflict with Rule" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)
else:
raise Warning("Section type %s could not have reloc strip flag" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)
@@ -4313,7 +4313,7 @@ class FdfParser:
raise Warning("expected Component version", self.FileName, self.CurrentLineNumber)
Pattern = re.compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$', re.DOTALL)
- if Pattern.match(self.__Token) == None:
+ if Pattern.match(self.__Token) is None:
raise Warning("Unknown version format '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
CompStatementObj.CompVer = self.__Token
@@ -4577,7 +4577,7 @@ class FdfParser:
for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".cap"):
continue
- if elementRegionData != None and elementRegionData.upper() not in CapList:
+ if elementRegionData is not None and elementRegionData.upper() not in CapList:
CapList.append(elementRegionData.upper())
return CapList
@@ -4593,15 +4593,15 @@ class FdfParser:
def __GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):
for CapsuleDataObj in CapObj.CapsuleDataList :
- if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:
+ if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName is not None and CapsuleDataObj.FvName.upper() not in RefFvList:
RefFvList.append (CapsuleDataObj.FvName.upper())
- elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName != None and CapsuleDataObj.FdName.upper() not in RefFdList:
+ elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName is not None and CapsuleDataObj.FdName.upper() not in RefFdList:
RefFdList.append (CapsuleDataObj.FdName.upper())
- elif CapsuleDataObj.Ffs != None:
+ elif CapsuleDataObj.Ffs is not None:
if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):
- if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
+ if CapsuleDataObj.Ffs.FvName is not None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())
- elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
+ elif CapsuleDataObj.Ffs.FdName is not None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())
else:
self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)
@@ -4624,7 +4624,7 @@ class FdfParser:
for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".fv"):
continue
- if elementRegionData != None and elementRegionData.upper() not in FvList:
+ if elementRegionData is not None and elementRegionData.upper() not in FvList:
FvList.append(elementRegionData.upper())
return FvList
@@ -4641,9 +4641,9 @@ class FdfParser:
for FfsObj in FvObj.FfsList:
if isinstance(FfsObj, FfsFileStatement.FileStatement):
- if FfsObj.FvName != None and FfsObj.FvName.upper() not in RefFvList:
+ if FfsObj.FvName is not None and FfsObj.FvName.upper() not in RefFvList:
RefFvList.append(FfsObj.FvName.upper())
- elif FfsObj.FdName != None and FfsObj.FdName.upper() not in RefFdList:
+ elif FfsObj.FdName is not None and FfsObj.FdName.upper() not in RefFdList:
RefFdList.append(FfsObj.FdName.upper())
else:
self.__GetReferencedFdFvTupleFromSection(FfsObj, RefFdList, RefFvList)
@@ -4664,9 +4664,9 @@ class FdfParser:
while SectionStack != []:
SectionObj = SectionStack.pop()
if isinstance(SectionObj, FvImageSection.FvImageSection):
- if SectionObj.FvName != None and SectionObj.FvName.upper() not in FvList:
+ if SectionObj.FvName is not None and SectionObj.FvName.upper() not in FvList:
FvList.append(SectionObj.FvName.upper())
- if SectionObj.Fv != None and SectionObj.Fv.UiFvName != None and SectionObj.Fv.UiFvName.upper() not in FvList:
+ if SectionObj.Fv is not None and SectionObj.Fv.UiFvName is not None and SectionObj.Fv.UiFvName.upper() not in FvList:
FvList.append(SectionObj.Fv.UiFvName.upper())
self.__GetReferencedFdFvTuple(SectionObj.Fv, FdList, FvList)
diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
index 12ec95b565..3fd5a9c215 100644
--- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py
@@ -59,7 +59,7 @@ class FileStatement (FileStatementClassObject) :
#
def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None, IsMakefile=False, FvName=None):
- if self.NameGuid != None and self.NameGuid.startswith('PCD('):
+ if self.NameGuid is not None and self.NameGuid.startswith('PCD('):
PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)
if len(PcdValue) == 0:
EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
@@ -81,7 +81,7 @@ class FileStatement (FileStatementClassObject) :
Dict.update(self.DefineVarDict)
SectionAlignments = None
- if self.FvName != None :
+ if self.FvName is not None :
Buffer = StringIO.StringIO('')
if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))
@@ -89,14 +89,14 @@ class FileStatement (FileStatementClassObject) :
FileName = Fv.AddToBuffer(Buffer)
SectionFiles = [FileName]
- elif self.FdName != None:
+ elif self.FdName is not None:
if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
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()
SectionFiles = [FileName]
- elif self.FileName != None:
+ elif self.FileName is not None:
if hasattr(self, 'FvFileType') and self.FvFileType == 'RAW':
if isinstance(self.FileName, list) and isinstance(self.SubAlignment, list) and len(self.FileName) == len(self.SubAlignment):
FileContent = ''
@@ -110,7 +110,7 @@ class FileStatement (FileStatementClassObject) :
Content = f.read()
f.close()
AlignValue = 1
- if self.SubAlignment[Index] != None:
+ if self.SubAlignment[Index] is not None:
AlignValue = GenFdsGlobalVariable.GetAlignment(self.SubAlignment[Index])
if AlignValue > MaxAlignValue:
MaxAlignIndex = Index
@@ -151,7 +151,7 @@ class FileStatement (FileStatementClassObject) :
section.FvAddr = FvChildAddr.pop(0)
elif isinstance(section, GuidSection):
section.FvAddr = FvChildAddr
- if FvParentAddr != None and isinstance(section, GuidSection):
+ if FvParentAddr is not None and isinstance(section, GuidSection):
section.FvParentAddr = FvParentAddr
if self.KeepReloc == False:
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index a348233911..0dbffffc9a 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -185,7 +185,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
InfLowerPath = str(PathClassObj).lower()
if self.OverrideGuid:
PathClassObj = ProcessDuplicatedInf(PathClassObj, self.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir)
- if self.CurrentArch != None:
+ if self.CurrentArch is not None:
Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
#
@@ -194,14 +194,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.BaseName = Inf.BaseName
self.ModuleGuid = Inf.Guid
self.ModuleType = Inf.ModuleType
- if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
if Inf.AutoGenVersion < 0x00010005:
self.ModuleType = Inf.ComponentType
self.VersionString = Inf.Version
self.BinFileList = Inf.Binaries
self.SourceFileList = Inf.Sources
- if self.KeepReloc == None and Inf.Shadow:
+ if self.KeepReloc is None and Inf.Shadow:
self.ShadowFromInfFile = Inf.Shadow
else:
@@ -209,7 +209,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
self.BaseName = Inf.BaseName
self.ModuleGuid = Inf.Guid
self.ModuleType = Inf.ModuleType
- if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+ if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']
self.VersionString = Inf.Version
self.BinFileList = Inf.Binaries
@@ -231,7 +231,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)
- if Inf._Defs != None and len(Inf._Defs) > 0:
+ if Inf._Defs is not None and len(Inf._Defs) > 0:
self.OptRomDefs.update(Inf._Defs)
self.PatchPcds = []
@@ -476,7 +476,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
# Allow binary type module not specify override rule in FDF file.
#
if len(self.BinFileList) > 0:
- if self.Rule == None or self.Rule == "":
+ if self.Rule is None or self.Rule == "":
self.Rule = "BINARY"
if not IsMakefile and GenFdsGlobalVariable.EnableGenfdsMultiThread and self.Rule != 'BINARY':
@@ -545,7 +545,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
def __GetRule__ (self) :
CurrentArchList = []
- if self.CurrentArch == None:
+ if self.CurrentArch is None:
CurrentArchList = ['common']
else:
CurrentArchList.append(self.CurrentArch)
@@ -556,13 +556,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
CurrentArch.upper() + \
'.' + \
self.ModuleType.upper()
- if self.Rule != None:
+ if self.Rule is not None:
RuleName = RuleName + \
'.' + \
self.Rule.upper()
Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)
- if Rule != None:
+ if Rule is not None:
GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)
return Rule
@@ -572,7 +572,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
'.' + \
self.ModuleType.upper()
- if self.Rule != None:
+ if self.Rule is not None:
RuleName = RuleName + \
'.' + \
self.Rule.upper()
@@ -580,11 +580,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))
Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)
- if Rule != None:
+ if Rule is not None:
GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)
return Rule
- if Rule == None :
+ if Rule is None :
EdkLogger.error("GenFds", GENFDS_ERROR, 'Don\'t Find common rule %s for INF %s' \
% (RuleName, self.InfFileName))
@@ -601,7 +601,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
DscArchList = []
for Arch in GenFdsGlobalVariable.ArchList :
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
- if PlatformDataBase != None:
+ if PlatformDataBase is not None:
if InfFileKey in PlatformDataBase.Modules:
DscArchList.append (Arch)
else:
@@ -648,7 +648,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
ArchList = CurArchList
UseArchList = TargetArchList
- if self.UseArch != None:
+ if self.UseArch is not None:
UseArchList = []
UseArchList.append(self.UseArch)
ArchList = list(set (UseArchList) & set (ArchList))
@@ -689,7 +689,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if self.OverrideGuid:
FileName = self.OverrideGuid
Arch = "NoneArch"
- if self.CurrentArch != None:
+ if self.CurrentArch is not None:
Arch = self.CurrentArch
OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],
@@ -723,7 +723,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
FileList = []
OutputFileList = []
GenSecInputFile = None
- if Rule.FileName != None:
+ if Rule.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
if os.path.isabs(GenSecInputFile):
GenSecInputFile = os.path.normpath(GenSecInputFile)
@@ -748,11 +748,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
- if self.KeepReloc != None:
+ if self.KeepReloc is not None:
NoStrip = self.KeepReloc
- elif Rule.KeepReloc != None:
+ elif Rule.KeepReloc is not None:
NoStrip = Rule.KeepReloc
- elif self.ShadowFromInfFile != None:
+ elif self.ShadowFromInfFile is not None:
NoStrip = self.ShadowFromInfFile
if FileList != [] :
@@ -868,7 +868,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
InputSection.append(InputFile)
SectionAlignments.append(Rule.SectAlignment)
- if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):
+ if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):
PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
if len(PcdValue) == 0:
EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):
- if Rule.KeepReloc != None:
+ if Rule.KeepReloc is not None:
self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = []
SectAlignments = []
@@ -957,7 +957,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
Sect.FvAddr = FvChildAddr.pop(0)
elif isinstance(Sect, GuidSection):
Sect.FvAddr = FvChildAddr
- if FvParentAddr != None and isinstance(Sect, GuidSection):
+ if FvParentAddr is not None and isinstance(Sect, GuidSection):
Sect.FvParentAddr = FvParentAddr
if Rule.KeyStringList != []:
@@ -1040,7 +1040,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
#
def __GenComplexFileFfs__(self, Rule, InputFile, Alignments, MakefilePath = None):
- if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):
+ if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):
PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)
if len(PcdValue) == 0:
EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \
@@ -1079,7 +1079,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
if Rule.CheckSum != False:
result += ('-s',)
- if Rule.Alignment != None and Rule.Alignment != '':
+ if Rule.Alignment is not None and Rule.Alignment != '':
result += ('-a', Rule.Alignment)
return result
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index c0b869d250..14e36b8859 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -70,14 +70,14 @@ class FV (FvClassObject):
#
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :
- if BaseAddress == None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
+ if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
#
# Check whether FV in Capsule is in FD flash region.
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
#
- if self.CapsuleName != None:
+ if self.CapsuleName is not None:
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
for RegionObj in FdObj.RegionList:
@@ -94,7 +94,7 @@ class FV (FvClassObject):
GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
FFSGuid = None
- if self.FvBaseAddress != None:
+ if self.FvBaseAddress is not None:
BaseAddress = self.FvBaseAddress
if not Flag:
self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
@@ -136,7 +136,7 @@ class FV (FvClassObject):
FvOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName)
FvOutputFile = FvOutputFile + '.Fv'
# BUGBUG: FvOutputFile could be specified from FDF file (FV section, CreateFile statement)
- if self.CreateFileName != None:
+ if self.CreateFileName is not None:
FvOutputFile = self.CreateFileName
if Flag:
@@ -163,7 +163,7 @@ class FV (FvClassObject):
NewFvInfo = None
if os.path.exists (FvInfoFileName):
NewFvInfo = open(FvInfoFileName, 'r').read()
- if NewFvInfo != None and NewFvInfo != OrigFvInfo:
+ if NewFvInfo is not None and NewFvInfo != OrigFvInfo:
FvChildAddr = []
AddFileObj = open(FvInfoFileName, 'r')
AddrStrings = AddFileObj.readlines()
@@ -273,16 +273,16 @@ class FV (FvClassObject):
# Add [Options]
#
self.FvInfFile.writelines("[options]" + T_CHAR_LF)
- if BaseAddress != None :
+ if BaseAddress is not None :
self.FvInfFile.writelines("EFI_BASE_ADDRESS = " + \
BaseAddress + \
T_CHAR_LF)
- if BlockSize != None:
+ if BlockSize is not None:
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
'0x%X' %BlockSize + \
T_CHAR_LF)
- if BlockNum != None:
+ if BlockNum is not None:
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
' 0x%X' %BlockNum + \
T_CHAR_LF)
@@ -293,20 +293,20 @@ class FV (FvClassObject):
self.FvInfFile.writelines("EFI_BLOCK_SIZE = 0x1" + T_CHAR_LF)
for BlockSize in self.BlockSizeList :
- if BlockSize[0] != None:
+ if BlockSize[0] is not None:
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
'0x%X' %BlockSize[0] + \
T_CHAR_LF)
- if BlockSize[1] != None:
+ if BlockSize[1] is not None:
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
' 0x%X' %BlockSize[1] + \
T_CHAR_LF)
- if self.BsBaseAddress != None:
+ if self.BsBaseAddress is not None:
self.FvInfFile.writelines('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \
'0x%X' %self.BsBaseAddress)
- if self.RtBaseAddress != None:
+ if self.RtBaseAddress is not None:
self.FvInfFile.writelines('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \
'0x%X' %self.RtBaseAddress)
#
@@ -317,7 +317,7 @@ class FV (FvClassObject):
self.FvInfFile.writelines("EFI_ERASE_POLARITY = " + \
' %s' %ErasePloarity + \
T_CHAR_LF)
- if not (self.FvAttributeDict == None):
+ if not (self.FvAttributeDict is None):
for FvAttribute in self.FvAttributeDict.keys() :
if FvAttribute == "FvUsedSizeEnable":
if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1') :
@@ -328,7 +328,7 @@ class FV (FvClassObject):
' = ' + \
self.FvAttributeDict[FvAttribute] + \
T_CHAR_LF )
- if self.FvAlignment != None:
+ if self.FvAlignment is not None:
self.FvInfFile.writelines("EFI_FVB2_ALIGNMENT_" + \
self.FvAlignment.strip() + \
" = TRUE" + \
@@ -337,7 +337,7 @@ class FV (FvClassObject):
#
# Generate FV extension header file
#
- if self.FvNameGuid == None or self.FvNameGuid == '':
+ if self.FvNameGuid is None or self.FvNameGuid == '':
if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:
GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
@@ -442,7 +442,7 @@ class FV (FvClassObject):
# Add [Files]
#
self.FvInfFile.writelines("[files]" + T_CHAR_LF)
- if VtfDict != None and self.UiFvName in VtfDict.keys():
+ if VtfDict is not None and self.UiFvName in VtfDict.keys():
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
VtfDict.get(self.UiFvName) + \
T_CHAR_LF)
diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py
index 916ff91917..5026a3ffca 100644
--- a/BaseTools/Source/Python/GenFds/FvImageSection.py
+++ b/BaseTools/Source/Python/GenFds/FvImageSection.py
@@ -53,7 +53,7 @@ class FvImageSection(FvImageSectionClassObject):
def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):
OutputFileList = []
- if self.FvFileType != None:
+ if self.FvFileType is not None:
FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FvFileType, self.FvFileExtension)
if IsSect :
return FileList, self.Alignment
@@ -96,20 +96,20 @@ class FvImageSection(FvImageSectionClassObject):
#
# Generate Fv
#
- if self.FvName != None:
+ if self.FvName is not None:
Buffer = StringIO.StringIO('')
Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)
- if Fv != None:
+ if Fv is not None:
self.Fv = Fv
FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict, Flag=IsMakefile)
- if Fv.FvAlignment != None:
- if self.Alignment == None:
+ if Fv.FvAlignment is not None:
+ if self.Alignment is None:
self.Alignment = Fv.FvAlignment
else:
if GenFdsGlobalVariable.GetAlignment (Fv.FvAlignment) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
self.Alignment = Fv.FvAlignment
else:
- if self.FvFileName != None:
+ if self.FvFileName is not None:
FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName)
if os.path.isfile(FvFileName):
FvFileObj = open (FvFileName,'rb')
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 26122fc099..49e26424bb 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -69,22 +69,22 @@ def main():
EdkLogger.Initialize()
try:
- if Options.verbose != None:
+ if Options.verbose is not None:
EdkLogger.SetLevel(EdkLogger.VERBOSE)
GenFdsGlobalVariable.VerboseMode = True
- if Options.FixedAddress != None:
+ if Options.FixedAddress is not None:
GenFdsGlobalVariable.FixedLoadAddress = True
- if Options.quiet != None:
+ if Options.quiet is not None:
EdkLogger.SetLevel(EdkLogger.QUIET)
- if Options.debug != None:
+ if Options.debug is not None:
EdkLogger.SetLevel(Options.debug + 1)
GenFdsGlobalVariable.DebugLevel = Options.debug
else:
EdkLogger.SetLevel(EdkLogger.INFO)
- if (Options.Workspace == None):
+ if (Options.Workspace is None):
EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",
ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
elif not os.path.exists(Options.Workspace):
@@ -179,7 +179,7 @@ def main():
# if no tool chain given in command line, get it from target.txt
if not GenFdsGlobalVariable.ToolChainTag:
ToolChainList = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]
- if ToolChainList == None or len(ToolChainList) == 0:
+ if ToolChainList is None or len(ToolChainList) == 0:
EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.")
if len(ToolChainList) != 1:
EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for ToolChain.")
@@ -300,7 +300,7 @@ def main():
"No such a Capsule in FDF file: %s" % Options.uiCapName)
GenFdsGlobalVariable.WorkSpace = BuildWorkSpace
- if ArchList != None:
+ if ArchList is not None:
GenFdsGlobalVariable.ArchList = ArchList
# Dsc Build Data will handle Pcd Settings from CommandLine.
@@ -340,7 +340,7 @@ def main():
EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)
ReturnCode = FORMAT_INVALID
except FatalError, X:
- if Options.debug != None:
+ if Options.debug is not None:
import traceback
EdkLogger.quiet(traceback.format_exc())
ReturnCode = X.args[0]
@@ -378,7 +378,7 @@ def SingleCheckCallback(option, opt_str, value, parser):
def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase
# if user not specify filter, try to deduce it from global data.
- if KeyStringList == None or KeyStringList == []:
+ if KeyStringList is None or KeyStringList == []:
Target = GenFdsGlobalVariable.TargetName
ToolChain = GenFdsGlobalVariable.ToolChainTag
if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:
@@ -411,7 +411,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'
ToolPath = ToolDefinition.get(ToolPathKey)
ToolOption = ToolDefinition.get(ToolOptionKey)
- if ToolPathTmp == None:
+ if ToolPathTmp is None:
ToolPathTmp = ToolPath
else:
if ToolPathTmp != ToolPath:
@@ -523,38 +523,38 @@ class GenFds :
GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)
GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")
- if GenFds.OnlyGenerateThisCap != None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
+ 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 CapsuleObj != None:
+ if CapsuleObj is not None:
CapsuleObj.GenCapsule()
return
- if GenFds.OnlyGenerateThisFd != 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.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())
- if FdObj != None:
+ if FdObj is not None:
FdObj.GenFd()
return
- elif GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisFv == None:
+ elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
FdObj.GenFd()
GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")
- if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
+ 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 FvObj != None:
+ if FvObj is not None:
Buffer = StringIO.StringIO()
FvObj.AddToBuffer(Buffer)
Buffer.close()
return
- elif GenFds.OnlyGenerateThisFv == None:
+ elif GenFds.OnlyGenerateThisFv is None:
for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
Buffer = StringIO.StringIO('')
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
FvObj.AddToBuffer(Buffer)
Buffer.close()
- if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisCap == None:
+ 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():
@@ -592,14 +592,14 @@ class GenFds :
def GetFvBlockSize(FvObj):
DefaultBlockSize = 0x1
FdObj = None
- if GenFds.OnlyGenerateThisFd != 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.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]
- if FdObj == None:
+ if FdObj is None:
for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():
for ElementRegion in ElementFd.RegionList:
if ElementRegion.RegionType == 'FV':
for ElementRegionData in ElementRegion.RegionDataList:
- if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:
+ if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
return FvObj.BlockSizeList[0][0]
else:
@@ -611,7 +611,7 @@ class GenFds :
for ElementRegion in FdObj.RegionList:
if ElementRegion.RegionType == 'FV':
for ElementRegionData in ElementRegion.RegionDataList:
- if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:
+ if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:
if FvObj.BlockSizeList != []:
return FvObj.BlockSizeList[0][0]
else:
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 97e20753ae..fcb191981c 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -229,7 +229,7 @@ class GenFdsGlobalVariable:
Source = SourceList[Index]
Index = Index + 1
- if File.IsBinary and File == Source and Inf.Binaries != None and File in Inf.Binaries:
+ if File.IsBinary and File == Source and Inf.Binaries is not None and File in Inf.Binaries:
# Skip all files that are not binary libraries
if not Inf.LibraryClass:
continue
@@ -420,7 +420,7 @@ class GenFdsGlobalVariable:
if not os.path.exists(Output):
return True
# always update "Output" if no "Input" given
- if Input == None or len(Input) == 0:
+ if Input is None or len(Input) == 0:
return True
# if fdf file is changed after the 'Output" is generated, update the 'Output'
@@ -445,9 +445,9 @@ class GenFdsGlobalVariable:
Cmd += ["-s", Type]
if CompressionType not in [None, '']:
Cmd += ["-c", CompressionType]
- if Guid != None:
+ if Guid is not None:
Cmd += ["-g", Guid]
- if DummyFile != None:
+ if DummyFile is not None:
Cmd += ["--dummy", DummyFile]
if GuidHdrLen not in [None, '']:
Cmd += ["-l", GuidHdrLen]
@@ -455,7 +455,7 @@ class GenFdsGlobalVariable:
#Add each guided attribute
for Attr in GuidAttr:
Cmd += ["-r", Attr]
- if InputAlign != None:
+ if InputAlign is not None:
#Section Align is only for dummy section without section type
for SecAlign in InputAlign:
Cmd += ["--sectionalign", SecAlign]
@@ -509,7 +509,7 @@ class GenFdsGlobalVariable:
@staticmethod
def GetAlignment (AlignString):
- if AlignString == None:
+ if AlignString is None:
return 0
if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"):
return int (AlignString.rstrip('K')) * 1024
@@ -669,13 +669,13 @@ class GenFdsGlobalVariable:
return
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
- if ClassCode != None:
+ if ClassCode is not None:
Cmd += ["-l", ClassCode]
- if Revision != None:
+ if Revision is not None:
Cmd += ["-r", Revision]
- if DeviceId != None:
+ if DeviceId is not None:
Cmd += ["-i", DeviceId]
- if VendorId != None:
+ if VendorId is not None:
Cmd += ["-f", VendorId]
Cmd += ["-o", Output]
@@ -726,7 +726,7 @@ class GenFdsGlobalVariable:
EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
(out, error) = PopenObject.communicate()
- while PopenObject.returncode == None :
+ while PopenObject.returncode is None :
PopenObject.wait()
if returnValue != [] and returnValue[0] != 0:
#get command return value
@@ -758,7 +758,7 @@ class GenFdsGlobalVariable:
# @param MacroDict Dictionary that contains macro value pair
#
def MacroExtend (Str, MacroDict={}, Arch='COMMON'):
- if Str == None :
+ if Str is None :
return None
Dict = {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceDir,
@@ -774,7 +774,7 @@ class GenFdsGlobalVariable:
Dict['$(OUTPUT_DIRECTORY)'] = OutputDir
- if MacroDict != None and len (MacroDict) != 0:
+ if MacroDict is not None and len (MacroDict) != 0:
Dict.update(MacroDict)
for key in Dict.keys():
@@ -794,7 +794,7 @@ class GenFdsGlobalVariable:
# @param PcdPattern pattern that labels a PCD.
#
def GetPcdValue (PcdPattern):
- if PcdPattern == None :
+ if PcdPattern is None :
return None
PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')
TokenSpace = PcdPair[0]
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py
index ea737bb9a7..8362073f97 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -60,7 +60,7 @@ class GuidSection(GuidSectionClassObject) :
#
self.KeyStringList = KeyStringList
self.CurrentArchList = GenFdsGlobalVariable.ArchList
- if FfsInf != None:
+ if FfsInf is not None:
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
self.NameGuid = FfsInf.__ExtendMacro__(self.NameGuid)
self.SectionType = FfsInf.__ExtendMacro__(self.SectionType)
@@ -79,7 +79,7 @@ class GuidSection(GuidSectionClassObject) :
if self.FvAddr != []:
#no use FvAddr when the image is processed.
self.FvAddr = []
- if self.FvParentAddr != None:
+ if self.FvParentAddr is not None:
#no use Parent Addr when the image is processed.
self.FvParentAddr = None
@@ -99,20 +99,20 @@ class GuidSection(GuidSectionClassObject) :
if Sect.IncludeFvSection:
self.IncludeFvSection = Sect.IncludeFvSection
- if align != None:
- if MaxAlign == None:
+ if align is not None:
+ if MaxAlign is None:
MaxAlign = align
if GenFdsGlobalVariable.GetAlignment (align) > GenFdsGlobalVariable.GetAlignment (MaxAlign):
MaxAlign = align
if ReturnSectList != []:
- if align == None:
+ if align is None:
align = "1"
for file in ReturnSectList:
SectFile += (file,)
SectAlign.append(align)
- if MaxAlign != None:
- if self.Alignment == None:
+ if MaxAlign is not None:
+ if self.Alignment is None:
self.Alignment = MaxAlign
else:
if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGlobalVariable.GetAlignment (self.Alignment):
@@ -128,21 +128,21 @@ class GuidSection(GuidSectionClassObject) :
ExternalTool = None
ExternalOption = None
- if self.NameGuid != None:
+ if self.NameGuid is not None:
ExternalTool, ExternalOption = FindExtendTool(self.KeyStringList, self.CurrentArchList, self.NameGuid)
#
# If not have GUID , call default
# GENCRC32 section
#
- if self.NameGuid == None :
+ if self.NameGuid is None :
GenFdsGlobalVariable.VerboseLogger("Use GenSection function Generate CRC32 Section")
GenFdsGlobalVariable.GenerateSection(OutputFile, SectFile, Section.Section.SectionType[self.SectionType], InputAlign=SectAlign, IsMakefile=IsMakefile)
OutputFileList = []
OutputFileList.append(OutputFile)
return OutputFileList, self.Alignment
#or GUID not in External Tool List
- elif ExternalTool == None:
+ elif ExternalTool is None:
EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)
else:
DummyFile = OutputFile + ".dummy"
@@ -170,10 +170,10 @@ class GuidSection(GuidSectionClassObject) :
FirstCall = False
CmdOption = '-e'
- if ExternalOption != None:
+ if ExternalOption is not None:
CmdOption = CmdOption + ' ' + ExternalOption
if not GenFdsGlobalVariable.EnableGenfdsMultiThread:
- if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr != None:
+ if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr is not None:
#FirstCall is only set for the encapsulated flash FV image without process required attribute.
FirstCall = True
#
@@ -213,7 +213,7 @@ class GuidSection(GuidSectionClassObject) :
if self.ExtraHeaderSize != -1:
HeaderLength = str(self.ExtraHeaderSize)
- if self.ProcessRequired == "NONE" and HeaderLength == None:
+ if self.ProcessRequired == "NONE" and HeaderLength is None:
if TempFileSize > InputFileSize:
FileHandleIn.seek(0)
BufferIn = FileHandleIn.read()
@@ -222,7 +222,7 @@ class GuidSection(GuidSectionClassObject) :
if BufferIn == BufferOut[TempFileSize - InputFileSize:]:
HeaderLength = str(TempFileSize - InputFileSize)
#auto sec guided attribute with process required
- if HeaderLength == None:
+ if HeaderLength is None:
Attribute.append('PROCESSING_REQUIRED')
FileHandleIn.close()
@@ -253,7 +253,7 @@ class GuidSection(GuidSectionClassObject) :
HeaderLength = str(self.ExtraHeaderSize)
if self.AuthStatusValid in ("TRUE", "1"):
Attribute.append('AUTH_STATUS_VALID')
- if self.ProcessRequired == "NONE" and HeaderLength == None:
+ if self.ProcessRequired == "NONE" and HeaderLength is None:
GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],
Guid=self.NameGuid, GuidAttr=Attribute,
GuidHdrLen=HeaderLength, DummyFile=DummyFile, IsMakefile=IsMakefile)
diff --git a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
index ab4fae611e..4ef9b4d0e9 100644
--- a/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomFileStatement.py
@@ -41,7 +41,7 @@ class OptRomFileStatement:
#
def GenFfs(self, Dict = {}, IsMakefile=False):
- if self.FileName != None:
+ if self.FileName is not None:
self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
return self.FileName
diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
index 80c4bbab6e..62d731fb9c 100644
--- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py
@@ -46,10 +46,10 @@ class OptRomInfStatement (FfsInfStatement):
#
def __GetOptRomParams(self):
- if self.OverrideAttribs == None:
+ if self.OverrideAttribs is None:
self.OverrideAttribs = OptionRom.OverrideAttribs()
- if self.OverrideAttribs.NeedCompress == None:
+ if self.OverrideAttribs.NeedCompress is None:
self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')
if self.OverrideAttribs.NeedCompress is not None:
if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):
@@ -57,16 +57,16 @@ class OptRomInfStatement (FfsInfStatement):
self.OverrideAttribs.NeedCompress = \
self.OverrideAttribs.NeedCompress.upper() == 'TRUE'
- if self.OverrideAttribs.PciVendorId == None:
+ if self.OverrideAttribs.PciVendorId is None:
self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')
- if self.OverrideAttribs.PciClassCode == None:
+ if self.OverrideAttribs.PciClassCode is None:
self.OverrideAttribs.PciClassCode = self.OptRomDefs.get ('PCI_CLASS_CODE')
- if self.OverrideAttribs.PciDeviceId == None:
+ if self.OverrideAttribs.PciDeviceId is None:
self.OverrideAttribs.PciDeviceId = self.OptRomDefs.get ('PCI_DEVICE_ID')
- if self.OverrideAttribs.PciRevision == None:
+ if self.OverrideAttribs.PciRevision is None:
self.OverrideAttribs.PciRevision = self.OptRomDefs.get ('PCI_REVISION')
# InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch]
@@ -121,7 +121,7 @@ class OptRomInfStatement (FfsInfStatement):
#
OutputFileList = []
- if Rule.FileName != None:
+ if Rule.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
OutputFileList.append(GenSecInputFile)
else:
@@ -143,7 +143,7 @@ class OptRomInfStatement (FfsInfStatement):
OutputFileList = []
for Sect in Rule.SectionList:
if Sect.SectionType == 'PE32':
- if Sect.FileName != None:
+ if Sect.FileName is not None:
GenSecInputFile = self.__ExtendMacro__(Sect.FileName)
OutputFileList.append(GenSecInputFile)
else:
diff --git a/BaseTools/Source/Python/GenFds/OptionRom.py b/BaseTools/Source/Python/GenFds/OptionRom.py
index 2e61a38c1d..b058415299 100644
--- a/BaseTools/Source/Python/GenFds/OptionRom.py
+++ b/BaseTools/Source/Python/GenFds/OptionRom.py
@@ -63,7 +63,7 @@ class OPTIONROM (OptionRomClassObject):
FilePathNameList = FfsFile.GenFfs(IsMakefile=Flag)
if len(FilePathNameList) == 0:
EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s not produce .efi files, so NO file could be put into option ROM." % (FfsFile.InfFileName))
- if FfsFile.OverrideAttribs == None:
+ if FfsFile.OverrideAttribs is None:
EfiFileList.extend(FilePathNameList)
else:
FileName = os.path.basename(FilePathNameList[0])
@@ -84,7 +84,7 @@ class OPTIONROM (OptionRomClassObject):
BinFileList.append(TmpOutputFile)
else:
FilePathName = FfsFile.GenFfs(IsMakefile=Flag)
- if FfsFile.OverrideAttribs != None:
+ if FfsFile.OverrideAttribs is not None:
FileName = os.path.basename(FilePathName)
TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)
if not os.path.exists(TmpOutputDir) :
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py
index c946758cf5..e639739b7e 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -114,7 +114,7 @@ class Region(RegionClassObject):
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
- if FvObj != None :
+ if FvObj is not None :
if not Flag:
GenFdsGlobalVariable.InfLogger(' Region Name = FV')
#
@@ -152,7 +152,7 @@ class Region(RegionClassObject):
# Add the exist Fv image into FD buffer
#
if not Flag:
- if FileName != None:
+ if FileName is not None:
FileLength = os.stat(FileName)[ST_SIZE]
if FileLength > Size:
EdkLogger.error("GenFds", GENFDS_ERROR,
@@ -193,7 +193,7 @@ class Region(RegionClassObject):
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]
- if CapsuleObj != None :
+ if CapsuleObj is not None :
CapsuleObj.CapsuleName = RegionData.upper()
GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
#
@@ -270,7 +270,7 @@ class Region(RegionClassObject):
#
self.PadBuffer(Buffer, ErasePolarity, Size)
- if self.RegionType == None:
+ if self.RegionType is None:
GenFdsGlobalVariable.InfLogger(' Region Name = None')
self.PadBuffer(Buffer, ErasePolarity, Size)
@@ -333,7 +333,7 @@ class Region(RegionClassObject):
# first check whether FvObj.BlockSizeList items have only "BlockSize" or "NumBlocks",
# if so, use ExpectedList
for Item in FvObj.BlockSizeList:
- if Item[0] == None or Item[1] == None:
+ if Item[0] is None or Item[1] is None:
FvObj.BlockSizeList = ExpectedList
break
# make sure region size is no smaller than the summed block size in FV
diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py
index 463faa3781..5e0b4bee7d 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -116,17 +116,17 @@ class Section (SectionClassObject):
else :
IsSect = False
- if FileExtension != None:
+ if FileExtension is not None:
Suffix = FileExtension
elif IsSect :
Suffix = Section.SectionType.get(FileType)
else:
Suffix = Section.BinFileType.get(FileType)
- if FfsInf == None:
+ if FfsInf is None:
EdkLogger.error("GenFds", GENFDS_ERROR, 'Inf File does not exist!')
FileList = []
- if FileType != None:
+ if FileType is not None:
for File in FfsInf.BinFileList:
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
@@ -141,7 +141,7 @@ class Section (SectionClassObject):
else:
GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))
- if (not IsMakefile and Suffix != None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix != None):
+ if (not IsMakefile and Suffix is not None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix is not None):
#
# Get Makefile path and time stamp
#
diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py
index 4f6926f7ca..6340520602 100644
--- a/BaseTools/Source/Python/GenFds/UiSection.py
+++ b/BaseTools/Source/Python/GenFds/UiSection.py
@@ -52,16 +52,16 @@ class UiSection (UiSectionClassObject):
#
# Prepare the parameter of GenSection
#
- if FfsInf != None:
+ if FfsInf is not None:
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
self.FileName = FfsInf.__ExtendMacro__(self.FileName)
OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))
- if self.StringData != None :
+ if self.StringData is not None :
NameString = self.StringData
- elif self.FileName != None:
+ elif self.FileName is not None:
FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
FileObj = open(FileNameStr, 'r')
diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py
index e29029980f..11e974b993 100644
--- a/BaseTools/Source/Python/GenFds/VerSection.py
+++ b/BaseTools/Source/Python/GenFds/VerSection.py
@@ -52,7 +52,7 @@ class VerSection (VerSectionClassObject):
#
# Prepare the parameter of GenSection
#
- if FfsInf != None:
+ if FfsInf is not None:
self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)
self.StringData = FfsInf.__ExtendMacro__(self.StringData)
@@ -64,9 +64,9 @@ class VerSection (VerSectionClassObject):
# Get String Data
StringData = ''
- if self.StringData != None:
+ if self.StringData is not None:
StringData = self.StringData
- elif self.FileName != None:
+ elif self.FileName is not None:
FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)
FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)
FileObj = open(FileNameStr, 'r')
diff --git a/BaseTools/Source/Python/GenFds/Vtf.py b/BaseTools/Source/Python/GenFds/Vtf.py
index 06e3d275c3..18ea37b9af 100644
--- a/BaseTools/Source/Python/GenFds/Vtf.py
+++ b/BaseTools/Source/Python/GenFds/Vtf.py
@@ -68,7 +68,7 @@ class Vtf (VtfClassObject):
FvList = self.GetFvList()
self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')
BsfInf = open(self.BsfInfName, 'w+')
- if self.ResetBin != None:
+ if self.ResetBin is not None:
BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)
BsfInf.writelines ("IA32_RST_BIN" + \
" = " + \
@@ -89,7 +89,7 @@ class Vtf (VtfClassObject):
'N' + \
T_CHAR_LF)
- elif ComponentObj.FilePos != None:
+ elif ComponentObj.FilePos is not None:
BsfInf.writelines ("COMP_LOC" + \
" = " + \
ComponentObj.FilePos + \