summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/UPT
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/UPT
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/UPT')
-rw-r--r--BaseTools/Source/Python/UPT/Core/DependencyRules.py4
-rw-r--r--BaseTools/Source/Python/UPT/Core/IpiDb.py30
-rw-r--r--BaseTools/Source/Python/UPT/Core/PackageFile.py2
-rw-r--r--BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py6
-rw-r--r--BaseTools/Source/Python/UPT/InstallPkg.py2
-rw-r--r--BaseTools/Source/Python/UPT/Library/CommentParsing.py12
-rw-r--r--BaseTools/Source/Python/UPT/Library/Misc.py10
-rw-r--r--BaseTools/Source/Python/UPT/Library/ParserValidate.py30
-rw-r--r--BaseTools/Source/Python/UPT/Library/Parsing.py10
-rw-r--r--BaseTools/Source/Python/UPT/Library/String.py8
-rw-r--r--BaseTools/Source/Python/UPT/Library/UniClassObject.py22
-rw-r--r--BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py10
-rw-r--r--BaseTools/Source/Python/UPT/Logger/Log.py18
-rw-r--r--BaseTools/Source/Python/UPT/MkPkg.py2
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py12
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py46
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py6
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py10
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py6
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py4
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py6
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py10
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py6
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py6
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py2
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py4
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py4
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py6
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py2
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py6
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py4
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py4
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfParser.py2
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfParserMisc.py4
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py2
-rw-r--r--BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py4
-rw-r--r--BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py18
-rw-r--r--BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py18
-rw-r--r--BaseTools/Source/Python/UPT/UPT.py2
-rw-r--r--BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py2
-rw-r--r--BaseTools/Source/Python/UPT/Xml/XmlParser.py38
41 files changed, 200 insertions, 200 deletions
diff --git a/BaseTools/Source/Python/UPT/Core/DependencyRules.py b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
index 26c5a97da8..2af847ed2e 100644
--- a/BaseTools/Source/Python/UPT/Core/DependencyRules.py
+++ b/BaseTools/Source/Python/UPT/Core/DependencyRules.py
@@ -104,12 +104,12 @@ class DependencyRules(object):
# check whether satisfied by current distribution
#
if not Exist:
- if DpObj == None:
+ if DpObj is None:
Result = False
break
for GuidVerPair in DpObj.PackageSurfaceArea.keys():
if Dep.GetGuid() == GuidVerPair[0]:
- if Dep.GetVersion() == None or \
+ if Dep.GetVersion() is None or \
len(Dep.GetVersion()) == 0:
Result = True
break
diff --git a/BaseTools/Source/Python/UPT/Core/IpiDb.py b/BaseTools/Source/Python/UPT/Core/IpiDb.py
index f147963288..78d67ab31e 100644
--- a/BaseTools/Source/Python/UPT/Core/IpiDb.py
+++ b/BaseTools/Source/Python/UPT/Core/IpiDb.py
@@ -247,13 +247,13 @@ class IpiDatabase(object):
def _AddDp(self, Guid, Version, NewDpFileName, DistributionFileName, \
RePackage):
- if Version == None or len(Version.strip()) == 0:
+ if Version is None or len(Version.strip()) == 0:
Version = 'N/A'
#
# Add newly installed DP information to DB.
#
- if NewDpFileName == None or len(NewDpFileName.strip()) == 0:
+ if NewDpFileName is None or len(NewDpFileName.strip()) == 0:
PkgFileName = 'N/A'
else:
PkgFileName = NewDpFileName
@@ -295,13 +295,13 @@ class IpiDatabase(object):
#
def _AddPackage(self, Guid, Version, DpGuid=None, DpVersion=None, Path=''):
- if Version == None or len(Version.strip()) == 0:
+ if Version is None or len(Version.strip()) == 0:
Version = 'N/A'
- if DpGuid == None or len(DpGuid.strip()) == 0:
+ if DpGuid is None or len(DpGuid.strip()) == 0:
DpGuid = 'N/A'
- if DpVersion == None or len(DpVersion.strip()) == 0:
+ if DpVersion is None or len(DpVersion.strip()) == 0:
DpVersion = 'N/A'
#
@@ -325,13 +325,13 @@ class IpiDatabase(object):
def _AddModuleInPackage(self, Guid, Version, Name, PkgGuid=None, \
PkgVersion=None, Path=''):
- if Version == None or len(Version.strip()) == 0:
+ if Version is None or len(Version.strip()) == 0:
Version = 'N/A'
- if PkgGuid == None or len(PkgGuid.strip()) == 0:
+ if PkgGuid is None or len(PkgGuid.strip()) == 0:
PkgGuid = 'N/A'
- if PkgVersion == None or len(PkgVersion.strip()) == 0:
+ if PkgVersion is None or len(PkgVersion.strip()) == 0:
PkgVersion = 'N/A'
if os.name == 'posix':
@@ -361,13 +361,13 @@ class IpiDatabase(object):
def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \
DpVersion=None, Path=''):
- if Version == None or len(Version.strip()) == 0:
+ if Version is None or len(Version.strip()) == 0:
Version = 'N/A'
- if DpGuid == None or len(DpGuid.strip()) == 0:
+ if DpGuid is None or len(DpGuid.strip()) == 0:
DpGuid = 'N/A'
- if DpVersion == None or len(DpVersion.strip()) == 0:
+ if DpVersion is None or len(DpVersion.strip()) == 0:
DpVersion = 'N/A'
#
@@ -391,10 +391,10 @@ class IpiDatabase(object):
def _AddModuleDepex(self, Guid, Version, Name, Path, DepexGuid=None, \
DepexVersion=None):
- if DepexGuid == None or len(DepexGuid.strip()) == 0:
+ if DepexGuid is None or len(DepexGuid.strip()) == 0:
DepexGuid = 'N/A'
- if DepexVersion == None or len(DepexVersion.strip()) == 0:
+ if DepexVersion is None or len(DepexVersion.strip()) == 0:
DepexVersion = 'N/A'
if os.name == 'posix':
@@ -510,7 +510,7 @@ class IpiDatabase(object):
#
def GetDp(self, Guid, Version):
- if Version == None or len(Version.strip()) == 0:
+ if Version is None or len(Version.strip()) == 0:
Version = 'N/A'
Logger.Verbose(ST.MSG_GET_DP_INSTALL_LIST)
(DpGuid, DpVersion) = (Guid, Version)
@@ -642,7 +642,7 @@ class IpiDatabase(object):
PackageVersion)
self.Cur.execute(SqlCommand)
- elif Version == None or len(Version.strip()) == 0:
+ elif Version is None or len(Version.strip()) == 0:
SqlCommand = """select * from %s where PackageGuid ='%s'""" % \
(self.PkgTable, Guid)
diff --git a/BaseTools/Source/Python/UPT/Core/PackageFile.py b/BaseTools/Source/Python/UPT/Core/PackageFile.py
index 5fafd85bff..ec6f5503ea 100644
--- a/BaseTools/Source/Python/UPT/Core/PackageFile.py
+++ b/BaseTools/Source/Python/UPT/Core/PackageFile.py
@@ -56,7 +56,7 @@ class PackageFile:
ExtraData="%s (%s)" % (FileName, str(Xstr)))
BadFile = self._ZipFile.testzip()
- if BadFile != None:
+ if BadFile is not None:
Logger.Error("PackagingTool", FILE_CHECKSUM_FAILURE,
ExtraData="[%s] in %s" % (BadFile, FileName))
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index d7eaf3ea1d..9373a14419 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -618,11 +618,11 @@ def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
# format of SourceFile|Family|TagName|ToolCode|FeatureFlag
#
Statement += SourceFile
- if TagName == None:
+ if TagName is None:
TagName = ''
- if ToolCode == None:
+ if ToolCode is None:
ToolCode = ''
- if HelpStr == None:
+ if HelpStr is None:
HelpStr = ''
if FeatureFlag:
Statement += '|' + Family + '|' + TagName + '|' + ToolCode + '|' + FeatureFlag
diff --git a/BaseTools/Source/Python/UPT/InstallPkg.py b/BaseTools/Source/Python/UPT/InstallPkg.py
index a8d0e1ec44..c0d56b55aa 100644
--- a/BaseTools/Source/Python/UPT/InstallPkg.py
+++ b/BaseTools/Source/Python/UPT/InstallPkg.py
@@ -91,7 +91,7 @@ def InstallNewPackage(WorkspaceDir, Path, CustomPath = False):
# @param PathList: The already installed standalone module Path list
#
def InstallNewModule(WorkspaceDir, Path, PathList = None):
- if PathList == None:
+ if PathList is None:
PathList = []
Path = ConvertPath(Path)
Path = os.path.normpath(Path)
diff --git a/BaseTools/Source/Python/UPT/Library/CommentParsing.py b/BaseTools/Source/Python/UPT/Library/CommentParsing.py
index e6d45103f9..38f7012fd4 100644
--- a/BaseTools/Source/Python/UPT/Library/CommentParsing.py
+++ b/BaseTools/Source/Python/UPT/Library/CommentParsing.py
@@ -555,15 +555,15 @@ def ParseComment (Comment, UsageTokens, TypeTokens, RemoveTokens, ParseVariable)
# from HelpText
#
for Token in List[0:NumTokens]:
- if Usage == None and Token in UsageTokens:
+ if Usage is None and Token in UsageTokens:
Usage = UsageTokens[Token]
HelpText = HelpText.replace(Token, '')
- if Usage != None or not ParseVariable:
+ if Usage is not None or not ParseVariable:
for Token in List[0:NumTokens]:
- if Type == None and Token in TypeTokens:
+ if Type is None and Token in TypeTokens:
Type = TypeTokens[Token]
HelpText = HelpText.replace(Token, '')
- if Usage != None:
+ if Usage is not None:
for Token in List[0:NumTokens]:
if Token in RemoveTokens:
HelpText = HelpText.replace(Token, '')
@@ -571,13 +571,13 @@ def ParseComment (Comment, UsageTokens, TypeTokens, RemoveTokens, ParseVariable)
#
# If no Usage token is present and set Usage to UNDEFINED
#
- if Usage == None:
+ if Usage is None:
Usage = 'UNDEFINED'
#
# If no Type token is present and set Type to UNDEFINED
#
- if Type == None:
+ if Type is None:
Type = 'UNDEFINED'
#
diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py
index 0d92cb3767..719445b3bd 100644
--- a/BaseTools/Source/Python/UPT/Library/Misc.py
+++ b/BaseTools/Source/Python/UPT/Library/Misc.py
@@ -120,7 +120,7 @@ def GuidStructureStringToGuidString(GuidValue):
# @param Directory: The directory name
#
def CreateDirectory(Directory):
- if Directory == None or Directory.strip() == "":
+ if Directory is None or Directory.strip() == "":
return True
try:
if not access(Directory, F_OK):
@@ -134,7 +134,7 @@ def CreateDirectory(Directory):
# @param Directory: The directory name
#
def RemoveDirectory(Directory, Recursively=False):
- if Directory == None or Directory.strip() == "" or not \
+ if Directory is None or Directory.strip() == "" or not \
os.path.exists(Directory):
return
if Recursively:
@@ -237,7 +237,7 @@ def GetNonMetaDataFiles(Root, SkipList, FullPath, PrefixPath):
#
def ValidFile(File, Ext=None):
File = File.replace('\\', '/')
- if Ext != None:
+ if Ext is not None:
FileExt = os.path.splitext(File)[1]
if FileExt.lower() != Ext.lower():
return False
@@ -423,7 +423,7 @@ class Sdict(IterableUserDict):
## update method
#
def update(self, Dict=None, **Kwargs):
- if Dict != None:
+ if Dict is not None:
for Key1, Val1 in Dict.items():
self[Key1] = Val1
if len(Kwargs):
@@ -529,7 +529,7 @@ class PathClass(object):
## _GetFileKey
#
def _GetFileKey(self):
- if self._Key == None:
+ if self._Key is None:
self._Key = self.Path.upper()
return self._Key
## Validate
diff --git a/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/BaseTools/Source/Python/UPT/Library/ParserValidate.py
index 028cf9a54f..2def90a93b 100644
--- a/BaseTools/Source/Python/UPT/Library/ParserValidate.py
+++ b/BaseTools/Source/Python/UPT/Library/ParserValidate.py
@@ -128,7 +128,7 @@ def IsValidInfComponentType(ComponentType):
#
def IsValidToolFamily(ToolFamily):
ReIsValieFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)
- if ReIsValieFamily.match(ToolFamily) == None:
+ if ReIsValieFamily.match(ToolFamily) is None:
return False
return True
@@ -159,7 +159,7 @@ def IsValidArch(Arch):
if Arch == 'common':
return True
ReIsValieArch = re.compile(r"^[a-zA-Z]+[a-zA-Z0-9]{0,}$", re.DOTALL)
- if ReIsValieArch.match(Arch) == None:
+ if ReIsValieArch.match(Arch) is None:
return False
return True
@@ -179,7 +179,7 @@ def IsValidFamily(Family):
return True
ReIsValidFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)
- if ReIsValidFamily.match(Family) == None:
+ if ReIsValidFamily.match(Family) is None:
return False
return True
@@ -199,13 +199,13 @@ def IsValidBuildOptionName(BuildOptionName):
ReIsValidBuildOption1 = re.compile(r"^\s*(\*)|([A-Z][a-zA-Z0-9]*)$")
ReIsValidBuildOption2 = re.compile(r"^\s*(\*)|([a-zA-Z][a-zA-Z0-9]*)$")
- if ReIsValidBuildOption1.match(ToolOptionList[0]) == None:
+ if ReIsValidBuildOption1.match(ToolOptionList[0]) is None:
return False
- if ReIsValidBuildOption1.match(ToolOptionList[1]) == None:
+ if ReIsValidBuildOption1.match(ToolOptionList[1]) is None:
return False
- if ReIsValidBuildOption2.match(ToolOptionList[2]) == None:
+ if ReIsValidBuildOption2.match(ToolOptionList[2]) is None:
return False
if ToolOptionList[3] == "*" and ToolOptionList[4] not in ['FAMILY', 'DLL', 'DPATH']:
@@ -442,7 +442,7 @@ def IsValidDecVersion(Word):
ReIsValidDecVersion = re.compile(r"[0-9]+\.?[0-9]+$")
else:
ReIsValidDecVersion = re.compile(r"[0-9]+$")
- if ReIsValidDecVersion.match(Word) == None:
+ if ReIsValidDecVersion.match(Word) is None:
return False
return True
@@ -457,7 +457,7 @@ def IsValidDecVersion(Word):
#
def IsValidHexVersion(Word):
ReIsValidHexVersion = re.compile(r"[0][xX][0-9A-Fa-f]{8}$", re.DOTALL)
- if ReIsValidHexVersion.match(Word) == None:
+ if ReIsValidHexVersion.match(Word) is None:
return False
return True
@@ -471,7 +471,7 @@ def IsValidHexVersion(Word):
#
def IsValidBuildNumber(Word):
ReIsValieBuildNumber = re.compile(r"[0-9]{1,4}$", re.DOTALL)
- if ReIsValieBuildNumber.match(Word) == None:
+ if ReIsValieBuildNumber.match(Word) is None:
return False
return True
@@ -488,7 +488,7 @@ def IsValidDepex(Word):
return IsValidCFormatGuid(Word[Index+4:].strip())
ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_\s\.]*$", re.DOTALL)
- if ReIsValidCName.match(Word) == None:
+ if ReIsValidCName.match(Word) is None:
return False
return True
@@ -585,11 +585,11 @@ def IsValidPcdValue(PcdValue):
return True
ReIsValidIntegerSingle = re.compile(r"^\s*[0-9]\s*$", re.DOTALL)
- if ReIsValidIntegerSingle.match(PcdValue) != None:
+ if ReIsValidIntegerSingle.match(PcdValue) is not None:
return True
ReIsValidIntegerMulti = re.compile(r"^\s*[1-9][0-9]+\s*$", re.DOTALL)
- if ReIsValidIntegerMulti.match(PcdValue) != None:
+ if ReIsValidIntegerMulti.match(PcdValue) is not None:
return True
#
@@ -654,7 +654,7 @@ def IsValidPcdValue(PcdValue):
#
def IsValidCVariableName(CName):
ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)
- if ReIsValidCName.match(CName) == None:
+ if ReIsValidCName.match(CName) is None:
return False
return True
@@ -669,7 +669,7 @@ def IsValidCVariableName(CName):
#
def IsValidIdentifier(Ident):
ReIdent = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)
- if ReIdent.match(Ident) == None:
+ if ReIdent.match(Ident) is None:
return False
return True
@@ -683,7 +683,7 @@ def IsValidIdentifier(Ident):
def IsValidDecVersionVal(Ver):
ReVersion = re.compile(r"[0-9]+(\.[0-9]{1,2})$")
- if ReVersion.match(Ver) == None:
+ if ReVersion.match(Ver) is None:
return False
return True
diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Source/Python/UPT/Library/Parsing.py
index c34e775144..791e064761 100644
--- a/BaseTools/Source/Python/UPT/Library/Parsing.py
+++ b/BaseTools/Source/Python/UPT/Library/Parsing.py
@@ -134,7 +134,7 @@ def GetLibraryClassOfInf(Item, ContainerFile, WorkspaceDir, LineNo= -1):
#
def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo= -1):
Format = '<TokenSpaceGuidCName>.<PcdCName>'
- if TokenInfoString != '' and TokenInfoString != None:
+ if TokenInfoString != '' and TokenInfoString is not None:
TokenInfoList = GetSplitValueList(TokenInfoString, DataType.TAB_SPLIT)
if len(TokenInfoList) == 2:
return True
@@ -433,7 +433,7 @@ def GetComponents(Lines, KeyValues, CommentCharacter):
LineList = Lines.split('\n')
for Line in LineList:
Line = CleanString(Line, CommentCharacter)
- if Line == None or Line == '':
+ if Line is None or Line == '':
continue
if FindBlock == False:
@@ -921,7 +921,7 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
FileLocalMacros[Name] = Value
ReIsValidMacroName = re.compile(r"^[A-Z][A-Z0-9_]*$", re.DOTALL)
- if ReIsValidMacroName.match(Name) == None:
+ if ReIsValidMacroName.match(Name) is None:
Logger.Error('Parser',
FORMAT_INVALID,
ST.ERR_MACRONAME_INVALID % (Name),
@@ -940,7 +940,7 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
# <UnicodeString>, <CArray> are subset of <AsciiString>.
#
ReIsValidMacroValue = re.compile(r"^[\x20-\x7e]*$", re.DOTALL)
- if ReIsValidMacroValue.match(Value) == None:
+ if ReIsValidMacroValue.match(Value) is None:
Logger.Error('Parser',
FORMAT_INVALID,
ST.ERR_MACROVALUE_INVALID % (Value),
@@ -979,7 +979,7 @@ def GenSection(SectionName, SectionDict, SplitArch=True, NeedBlankLine=False):
else:
Section = '[' + SectionName + ']'
Content += '\n' + Section + '\n'
- if StatementList != None:
+ if StatementList is not None:
for Statement in StatementList:
LineList = Statement.split('\n')
NewStatement = ""
diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Source/Python/UPT/Library/String.py
index 278073e4a3..b79891ea14 100644
--- a/BaseTools/Source/Python/UPT/Library/String.py
+++ b/BaseTools/Source/Python/UPT/Library/String.py
@@ -166,7 +166,7 @@ def SplitModuleType(Key):
#
def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None, FileName=None, Flag=False):
LastString = String
- if MacroDefinitions == None:
+ if MacroDefinitions is None:
MacroDefinitions = {}
while MacroDefinitions:
QuotedStringList = []
@@ -244,7 +244,7 @@ def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None
#
def NormPath(Path, Defines=None):
IsRelativePath = False
- if Defines == None:
+ if Defines is None:
Defines = {}
if Path:
if Path[0] == '.':
@@ -524,7 +524,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
# to be checked
#
def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
- if CheckFilename != '' and CheckFilename != None:
+ if CheckFilename != '' and CheckFilename is not None:
(Root, Ext) = os.path.splitext(CheckFilename)
if Ext.upper() != ExtName.upper() and Root:
ContainerFile = open(ContainerFilename, 'r').read()
@@ -552,7 +552,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
#
def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
CheckFile = ''
- if CheckFilename != '' and CheckFilename != None:
+ if CheckFilename != '' and CheckFilename is not None:
CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
if not os.path.isfile(CheckFile):
ContainerFile = open(ContainerFilename, 'r').read()
diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index 0014a7561b..66eefee9db 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -161,7 +161,7 @@ def GetLanguageCode1766(LangName, File=None):
for Key in gLANG_CONV_TABLE.keys():
if gLANG_CONV_TABLE.get(Key) == LangName[0:2].lower():
return Key
- if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) == None and LangName[3] == '-':
+ if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':
for Key in gLANG_CONV_TABLE.keys():
if Key == LangName[0:3].lower():
return Key
@@ -186,7 +186,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
if IsCompatibleMode:
if length == 3 and LangName.isalpha():
TempLangName = gLANG_CONV_TABLE.get(LangName.lower())
- if TempLangName != None:
+ if TempLangName is not None:
return TempLangName
return LangName
else:
@@ -200,7 +200,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
if LangName.isalpha():
return LangName
elif length == 3:
- if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) == None:
+ if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None:
return LangName
elif length == 5:
if LangName[0:2].isalpha() and LangName[2] == '-':
@@ -208,7 +208,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
elif length >= 6:
if LangName[0:2].isalpha() and LangName[2] == '-':
return LangName
- if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) == None and LangName[3] == '-':
+ if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':
return LangName
EdkLogger.Error("Unicode File Parser",
@@ -270,14 +270,14 @@ class StringDefClassObject(object):
self.UseOtherLangDef = UseOtherLangDef
self.Length = 0
- if Name != None:
+ if Name is not None:
self.StringName = Name
self.StringNameByteList = UniToHexList(Name)
- if Value != None:
+ if Value is not None:
self.StringValue = Value
self.StringValueByteList = UniToHexList(self.StringValue)
self.Length = len(self.StringValueByteList)
- if Token != None:
+ if Token is not None:
self.Token = Token
def __str__(self):
@@ -288,7 +288,7 @@ class StringDefClassObject(object):
repr(self.UseOtherLangDef)
def UpdateValue(self, Value = None):
- if Value != None:
+ if Value is not None:
if self.StringValue:
self.StringValue = self.StringValue + '\r\n' + Value
else:
@@ -393,7 +393,7 @@ class UniFileClassObject(object):
# Check the string name is the upper character
if Name != '':
MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
- if MatchString == None or MatchString.end(0) != len(Name):
+ if MatchString is None or MatchString.end(0) != len(Name):
EdkLogger.Error("Unicode File Parser",
ToolError.FORMAT_INVALID,
'The string token name %s in UNI file %s must be upper case character.' %(Name, self.File))
@@ -798,7 +798,7 @@ class UniFileClassObject(object):
# Load a .uni file
#
def LoadUniFile(self, File = None):
- if File == None:
+ if File is None:
EdkLogger.Error("Unicode File Parser",
ToolError.PARSER_ERROR,
Message='No unicode file is given',
@@ -901,7 +901,7 @@ class UniFileClassObject(object):
IsAdded = True
if Name in self.OrderedStringDict[Language]:
IsAdded = False
- if Value != None:
+ if Value is not None:
ItemIndexInList = self.OrderedStringDict[Language][Name]
Item = self.OrderedStringList[Language][ItemIndexInList]
Item.UpdateValue(Value)
diff --git a/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py b/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
index d7614b8849..f20ae4dfa8 100644
--- a/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
+++ b/BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
@@ -36,14 +36,14 @@ import Logger.Log as Logger
def CreateXmlElement(Name, String, NodeList, AttributeList):
Doc = xml.dom.minidom.Document()
Element = Doc.createElement(Name)
- if String != '' and String != None:
+ if String != '' and String is not None:
Element.appendChild(Doc.createTextNode(String))
for Item in NodeList:
if type(Item) == type([]):
Key = Item[0]
Value = Item[1]
- if Key != '' and Key != None and Value != '' and Value != None:
+ if Key != '' and Key is not None and Value != '' and Value is not None:
Node = Doc.createElement(Key)
Node.appendChild(Doc.createTextNode(Value))
Element.appendChild(Node)
@@ -52,7 +52,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
for Item in AttributeList:
Key = Item[0]
Value = Item[1]
- if Key != '' and Key != None and Value != '' and Value != None:
+ if Key != '' and Key is not None and Value != '' and Value is not None:
Element.setAttribute(Key, Value)
return Element
@@ -66,7 +66,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
# @param String A XPath style path.
#
def XmlList(Dom, String):
- if String == None or String == "" or Dom == None or Dom == "":
+ if String is None or String == "" or Dom is None or Dom == "":
return []
if Dom.nodeType == Dom.DOCUMENT_NODE:
Dom = Dom.documentElement
@@ -101,7 +101,7 @@ def XmlList(Dom, String):
# @param String A XPath style path.
#
def XmlNode(Dom, String):
- if String == None or String == "" or Dom == None or Dom == "":
+ if String is None or String == "" or Dom is None or Dom == "":
return None
if Dom.nodeType == Dom.DOCUMENT_NODE:
Dom = Dom.documentElement
diff --git a/BaseTools/Source/Python/UPT/Logger/Log.py b/BaseTools/Source/Python/UPT/Logger/Log.py
index 407a1b32b6..ae06a1ae2a 100644
--- a/BaseTools/Source/Python/UPT/Logger/Log.py
+++ b/BaseTools/Source/Python/UPT/Logger/Log.py
@@ -134,7 +134,7 @@ def Debug(Level, Message, ExtraData=None):
"msg" : Message,
}
- if ExtraData != None:
+ if ExtraData is not None:
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n %s" % ExtraData
else:
LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict
@@ -165,10 +165,10 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
#
# if no tool name given, use caller's source file name as tool name
#
- if ToolName == None or ToolName == "":
+ if ToolName is None or ToolName == "":
ToolName = os.path.basename(extract_stack()[-2][0])
- if Line == None:
+ if Line is None:
Line = "..."
else:
Line = "%d" % Line
@@ -180,12 +180,12 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
"msg" : Message,
}
- if File != None:
+ if File is not None:
LogText = _WARNING_MESSAGE_TEMPLATE % TemplateDict
else:
LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
- if ExtraData != None:
+ if ExtraData is not None:
LogText += "\n %s" % ExtraData
_INFO_LOGGER.log(WARN, LogText)
@@ -215,18 +215,18 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
ExtraData=None, RaiseError=IS_RAISE_ERROR):
if ToolName:
pass
- if Line == None:
+ if Line is None:
Line = "..."
else:
Line = "%d" % Line
- if Message == None:
+ if Message is None:
if ErrorCode in gERROR_MESSAGE:
Message = gERROR_MESSAGE[ErrorCode]
else:
Message = gERROR_MESSAGE[UNKNOWN_ERROR]
- if ExtraData == None:
+ if ExtraData is None:
ExtraData = ""
TemplateDict = {
@@ -238,7 +238,7 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
"extra" : ExtraData
}
- if File != None:
+ if File is not None:
LogText = _ERROR_MESSAGE_TEMPLATE % TemplateDict
else:
LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict
diff --git a/BaseTools/Source/Python/UPT/MkPkg.py b/BaseTools/Source/Python/UPT/MkPkg.py
index 87c84f0cc2..ff9aa7fb11 100644
--- a/BaseTools/Source/Python/UPT/MkPkg.py
+++ b/BaseTools/Source/Python/UPT/MkPkg.py
@@ -73,7 +73,7 @@ def CheckForExistingDp(Path):
#
#
def Main(Options = None):
- if Options == None:
+ if Options is None:
Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)
try:
DataBase = GlobalData.gDB
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
index f968beee60..33b142d64e 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
@@ -271,7 +271,7 @@ class InfBinariesObject(InfSectionCommonDef):
#
pass
- if InfBianryVerItemObj != None:
+ if InfBianryVerItemObj is not None:
if self.Binaries.has_key((InfBianryVerItemObj)):
BinariesList = self.Binaries[InfBianryVerItemObj]
BinariesList.append((InfBianryVerItemObj, VerComment))
@@ -521,7 +521,7 @@ class InfBinariesObject(InfSectionCommonDef):
# #
# pass
- if InfBianryCommonItemObj != None:
+ if InfBianryCommonItemObj is not None:
if self.Binaries.has_key((InfBianryCommonItemObj)):
BinariesList = self.Binaries[InfBianryCommonItemObj]
BinariesList.append((InfBianryCommonItemObj, ItemComment))
@@ -538,11 +538,11 @@ class InfBinariesObject(InfSectionCommonDef):
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
__SupArchList.append(ArchItem)
- if UiInf != None:
+ if UiInf is not None:
if len(UiInf) > 0:
#
# Check UI
@@ -672,7 +672,7 @@ class InfBinariesObject(InfSectionCommonDef):
# #
# pass
- if InfBianryUiItemObj != None:
+ if InfBianryUiItemObj is not None:
if self.Binaries.has_key((InfBianryUiItemObj)):
BinariesList = self.Binaries[InfBianryUiItemObj]
BinariesList.append((InfBianryUiItemObj, UiComment))
@@ -681,7 +681,7 @@ class InfBinariesObject(InfSectionCommonDef):
BinariesList = []
BinariesList.append((InfBianryUiItemObj, UiComment))
self.Binaries[InfBianryUiItemObj] = BinariesList
- if Ver != None and len(Ver) > 0:
+ if Ver is not None and len(Ver) > 0:
self.CheckVer(Ver, __SupArchList)
if CommonBinary and len(CommonBinary) > 0:
self.ParseCommonBinary(CommonBinary, __SupArchList)
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
index 1d074ee638..bbc797f65e 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
@@ -62,7 +62,7 @@ class InfDefSectionOptionRomInfo():
#
# Value has been set before.
#
- if self.PciVendorId != None:
+ if self.PciVendorId is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_VENDOR_ID),
LineInfo=self.CurrentLine)
return False
@@ -86,7 +86,7 @@ class InfDefSectionOptionRomInfo():
#
# Value has been set before.
#
- if self.PciDeviceId != None:
+ if self.PciDeviceId is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_DEVICE_ID),
LineInfo=self.CurrentLine)
return False
@@ -110,7 +110,7 @@ class InfDefSectionOptionRomInfo():
#
# Value has been set before.
#
- if self.PciClassCode != None:
+ if self.PciClassCode is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_CLASS_CODE),
LineInfo=self.CurrentLine)
return False
@@ -135,7 +135,7 @@ class InfDefSectionOptionRomInfo():
#
# Value has been set before.
#
- if self.PciRevision != None:
+ if self.PciRevision is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_REVISION),
LineInfo=self.CurrentLine)
return False
@@ -159,7 +159,7 @@ class InfDefSectionOptionRomInfo():
#
# Value has been set before.
#
- if self.PciCompress != None:
+ if self.PciCompress is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_COMPRESS),
LineInfo=self.CurrentLine)
return False
@@ -215,11 +215,11 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.BaseName != None:
+ if self.BaseName is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_BASE_NAME),
LineInfo=self.CurrentLine)
return False
- if not (BaseName == '' or BaseName == None):
+ if not (BaseName == '' or BaseName is None):
if IsValidWord(BaseName) and not BaseName.startswith("_"):
self.BaseName = InfDefMember()
self.BaseName.SetValue(BaseName)
@@ -243,7 +243,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.FileGuid != None:
+ if self.FileGuid is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_FILE_GUID),
LineInfo=self.CurrentLine)
@@ -274,7 +274,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.ModuleType != None:
+ if self.ModuleType is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_MODULE_TYPE),
LineInfo=self.CurrentLine)
@@ -309,7 +309,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
def SetModuleUniFileName(self, ModuleUniFileName, Comments):
if Comments:
pass
- if self.ModuleUniFileName != None:
+ if self.ModuleUniFileName is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_MODULE_UNI_FILE),
LineInfo=self.CurrentLine)
self.ModuleUniFileName = ModuleUniFileName
@@ -327,7 +327,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.InfVersion != None:
+ if self.InfVersion is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_INF_VERSION),
LineInfo=self.CurrentLine)
@@ -368,7 +368,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.EdkReleaseVersion != None:
+ if self.EdkReleaseVersion is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION),
LineInfo=self.CurrentLine)
@@ -401,7 +401,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.UefiSpecificationVersion != None:
+ if self.UefiSpecificationVersion is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION),
LineInfo=self.CurrentLine)
@@ -434,7 +434,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.PiSpecificationVersion != None:
+ if self.PiSpecificationVersion is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION),
LineInfo=self.CurrentLine)
@@ -495,7 +495,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.VersionString != None:
+ if self.VersionString is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_VERSION_STRING),
LineInfo=self.CurrentLine)
@@ -517,7 +517,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.PcdIsDriver != None:
+ if self.PcdIsDriver is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
%(DT.TAB_INF_DEFINES_PCD_IS_DRIVER),
LineInfo=self.CurrentLine)
@@ -710,7 +710,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.Shadow != None:
+ if self.Shadow is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_SHADOW),
LineInfo=self.CurrentLine)
return False
@@ -731,7 +731,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
# <CustomMake> ::= [<Family> "|"] <Filename>
#
def SetCustomMakefile(self, CustomMakefile, Comments):
- if not (CustomMakefile == '' or CustomMakefile == None):
+ if not (CustomMakefile == '' or CustomMakefile is None):
ValueList = GetSplitValueList(CustomMakefile)
if len(ValueList) == 1:
FileName = ValueList[0]
@@ -811,12 +811,12 @@ class InfDefSection(InfDefSectionOptionRomInfo):
#
# Value has been set before.
#
- if self.UefiHiiResourceSection != None:
+ if self.UefiHiiResourceSection is not None:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND
%(DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION),
LineInfo=self.CurrentLine)
return False
- if not (UefiHiiResourceSection == '' or UefiHiiResourceSection == None):
+ if not (UefiHiiResourceSection == '' or UefiHiiResourceSection is None):
if (IsValidBoolType(UefiHiiResourceSection)):
self.UefiHiiResourceSection = InfDefMember()
self.UefiHiiResourceSection.SetValue(UefiHiiResourceSection)
@@ -948,7 +948,7 @@ class InfDefObject(InfSectionCommonDef):
RaiseError=True)
if Name == DT.TAB_INF_DEFINES_INF_VERSION:
HasFoundInfVersionFalg = True
- if not (Name == '' or Name == None):
+ if not (Name == '' or Name is None):
#
# Process "SPEC" Keyword definition.
#
@@ -971,7 +971,7 @@ class InfDefObject(InfSectionCommonDef):
LineInfo=LineInfo)
else:
ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
- if (ProcessFunc != None):
+ if (ProcessFunc is not None):
ProcessFunc(DefineList, Value, InfLineCommentObj)
self.Defines[ArchListString] = DefineList
else:
@@ -991,7 +991,7 @@ class InfDefObject(InfSectionCommonDef):
#
else:
ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]
- if (ProcessFunc != None):
+ if (ProcessFunc is not None):
ProcessFunc(DefineList, Value, InfLineCommentObj)
self.Defines[ArchListString] = DefineList
#
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
index 23125552e0..fb8d1f5a62 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
@@ -107,7 +107,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
#
# Get/Set Usage and HelpString
#
- if CommentsList != None and len(CommentsList) != 0 :
+ if CommentsList is not None and len(CommentsList) != 0 :
CommentInsList = []
PreUsage = None
PreGuidType = None
@@ -126,7 +126,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
[],
True)
- if CommentItemHelpText == None:
+ if CommentItemHelpText is None:
CommentItemHelpText = ''
if Count == len(CommentsList) and CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:
CommentItemHelpText = DT.END_OF_LINE
@@ -236,7 +236,7 @@ class InfGuidObject():
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
__SupportArchList.append(ArchItem)
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
index 45fba31aaa..dce75063df 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
@@ -43,7 +43,7 @@ class InfHeaderObject():
# @param FileName: File Name
#
def SetFileName(self, FileName):
- if not (FileName == '' or FileName == None):
+ if not (FileName == '' or FileName is None):
self.FileName = FileName
return True
else:
@@ -59,7 +59,7 @@ class InfHeaderObject():
# @param Abstract: Abstract
#
def SetAbstract(self, Abstract):
- if not (Abstract == '' or Abstract == None):
+ if not (Abstract == '' or Abstract is None):
self.Abstract = Abstract
return True
else:
@@ -75,7 +75,7 @@ class InfHeaderObject():
# @param Description: Description content
#
def SetDescription(self, Description):
- if not (Description == '' or Description == None):
+ if not (Description == '' or Description is None):
self.Description = Description
return True
else:
@@ -91,7 +91,7 @@ class InfHeaderObject():
# @param Copyright: Copyright content
#
def SetCopyright(self, Copyright):
- if not (Copyright == '' or Copyright == None):
+ if not (Copyright == '' or Copyright is None):
self.Copyright = Copyright
return True
else:
@@ -107,7 +107,7 @@ class InfHeaderObject():
# @param License: License content
#
def SetLicense(self, License):
- if not (License == '' or License == None):
+ if not (License == '' or License is None):
self.License = License
return True
else:
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
index b18c4c381b..e588c6ba66 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
@@ -38,10 +38,10 @@ def GetArchModuleType(KeyList):
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
- if (ModuleItem == '' or ModuleItem == None):
+ if (ModuleItem == '' or ModuleItem is None):
ModuleItem = 'COMMON'
if ArchItem not in __SupArchList:
@@ -136,7 +136,7 @@ class InfLibraryClassObject():
LibItemObj.CurrentLine.SetLineNo(LibItem[2][1])
LibItemObj.CurrentLine.SetLineString(LibItem[2][0])
LibItem = LibItem[0]
- if HelpStringObj != None:
+ if HelpStringObj is not None:
LibItemObj.SetHelpString(HelpStringObj)
if len(LibItem) >= 1:
if LibItem[0].strip() != '':
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py b/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
index 74099e2088..37f8cb2336 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
@@ -135,9 +135,9 @@ class InfSpecialCommentObject(InfSectionCommonDef):
# An encapsulate of Error for INF parser.
#
def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):
- if ErrorCode == None:
+ if ErrorCode is None:
ErrorCode = ToolError.FORMAT_INVALID
- if LineInfo == None:
+ if LineInfo is None:
LineInfo = ['', -1, '']
Logger.Error("InfParser",
ErrorCode,
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
index 37399134db..01c854a847 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
@@ -75,7 +75,7 @@ class InfPackageObject():
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
SupArchList.append(ArchItem)
@@ -84,7 +84,7 @@ class InfPackageObject():
HelpStringObj = PackageItem[1]
CurrentLineOfPackItem = PackageItem[2]
PackageItem = PackageItem[0]
- if HelpStringObj != None:
+ if HelpStringObj is not None:
HelpString = HelpStringObj.HeaderComments + HelpStringObj.TailComments
PackageItemObj.SetHelpString(HelpString)
if len(PackageItem) >= 1:
@@ -183,5 +183,5 @@ class InfPackageObject():
return True
def GetPackages(self, Arch = None):
- if Arch == None:
+ if Arch is None:
return self.Packages \ No newline at end of file
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
index 7b07036f91..d2712a97f2 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
@@ -43,7 +43,7 @@ def ValidateArch(ArchItem, PcdTypeItem1, LineNo, SupArchDict, SupArchList):
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
if PcdTypeItem1.upper != DT.TAB_INF_FEATURE_PCD.upper():
@@ -82,7 +82,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
if PcdTypeItem == 'FeaturePcd':
CommentItemUsage = DT.USAGE_ITEM_CONSUMES
- if CommentItemHelpText == None:
+ if CommentItemHelpText is None:
CommentItemHelpText = ''
if Count == 1:
@@ -96,7 +96,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
else:
continue
- if CommentItemHelpText == None:
+ if CommentItemHelpText is None:
CommentItemHelpText = ''
if Count == len(CommentList) and CommentItemUsage == DT.ITEM_UNDEFINED:
CommentItemHelpText = DT.END_OF_LINE
@@ -326,7 +326,7 @@ class InfPcdObject():
#
# Validate PcdType
#
- if (PcdTypeItem1 == '' or PcdTypeItem1 == None):
+ if (PcdTypeItem1 == '' or PcdTypeItem1 is None):
return False
else:
if not IsValidPcdType(PcdTypeItem1):
@@ -346,7 +346,7 @@ class InfPcdObject():
CurrentLineOfPcdItem = PcdItem[2]
PcdItem = PcdItem[0]
- if CommentList != None and len(CommentList) != 0:
+ if CommentList is not None and len(CommentList) != 0:
PcdItemObj = ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj)
else:
CommentItemIns = InfPcdItemCommentContent()
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
index 4df62bb459..eb6b692714 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
@@ -51,7 +51,7 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
if CommentItemString:
pass
- if CommentItemHelpText == None:
+ if CommentItemHelpText is None:
CommentItemHelpText = ''
if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
CommentItemHelpText = DT.END_OF_LINE
@@ -213,7 +213,7 @@ class InfPpiObject():
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
__SupArchList.append(ArchItem)
@@ -290,7 +290,7 @@ class InfPpiObject():
#
# Get/Set Usage and HelpString for PPI entry
#
- if CommentsList != None and len(CommentsList) != 0:
+ if CommentsList is not None and len(CommentsList) != 0:
InfPpiItemObj = ParsePpiComment(CommentsList, InfPpiItemObj)
else:
CommentItemIns = InfPpiItemCommentContent()
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
index c94e53c98f..eb03095d6f 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
@@ -49,7 +49,7 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
if CommentItemString:
pass
- if CommentItemHelpText == None:
+ if CommentItemHelpText is None:
CommentItemHelpText = ''
if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:
CommentItemHelpText = DT.END_OF_LINE
@@ -203,7 +203,7 @@ class InfProtocolObject():
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
__SupArchList.append(ArchItem)
@@ -259,7 +259,7 @@ class InfProtocolObject():
#
# Get/Set Usage and HelpString for Protocol entry
#
- if CommentsList != None and len(CommentsList) != 0:
+ if CommentsList is not None and len(CommentsList) != 0:
InfProtocolItemObj = ParseProtocolComment(CommentsList, InfProtocolItemObj)
else:
CommentItemIns = InfProtocolItemCommentContent()
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
index 9988f8ecfe..2302dd5b96 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
@@ -211,7 +211,7 @@ class InfSourcesObject(InfSectionCommonDef):
#
# Validate Arch
#
- if (ArchItem == '' or ArchItem == None):
+ if (ArchItem == '' or ArchItem is None):
ArchItem = 'COMMON'
__SupArchList.append(ArchItem)
diff --git a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
index 498f2d7634..4eed04c017 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
@@ -155,7 +155,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
DT.MODEL_META_DATA_HEADER,
DefineSectionMacros)
- if Name != None:
+ if Name is not None:
DefineSectionMacros[Name] = Value
continue
@@ -168,7 +168,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
FileNameString,
DT.MODEL_META_DATA_PACKAGE,
DefineSectionMacros)
- if Name != None:
+ if Name is not None:
PackageSectionMacros[Name] = Value
continue
diff --git a/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
index f1d6943cbf..f220402cb5 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
@@ -112,7 +112,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
if BinLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
TailComments = BinLineContent[BinLineContent.find(DT.TAB_COMMENT_SPLIT):]
BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]
- if LineComment == None:
+ if LineComment is None:
LineComment = InfLineCommentObject()
LineComment.SetTailComments(TailComments)
@@ -123,7 +123,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_BINARY_FILE,
self.FileLocalMacros)
- if MacroDef[0] != None:
+ if MacroDef[0] is not None:
SectionMacros[MacroDef[0]] = MacroDef[1]
LineComment = None
HeaderComments = []
diff --git a/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
index d00087a128..f7749d55a0 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
@@ -133,7 +133,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
TailComments = LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):]
LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
- if LineComment == None:
+ if LineComment is None:
LineComment = InfLineCommentObject()
LineComment.SetTailComments(TailComments)
@@ -144,7 +144,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_META_DATA_HEADER,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
self.FileLocalMacros[Name] = Value
continue
@@ -173,7 +173,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
Name, Value = _ValueList[0], _ValueList[1]
InfDefMemberObj = InfDefMember(Name, Value)
- if (LineComment != None):
+ if (LineComment is not None):
InfDefMemberObj.Comments.SetHeaderComments(LineComment.GetHeaderComments())
InfDefMemberObj.Comments.SetTailComments(LineComment.GetTailComments())
diff --git a/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
index 5cafc80ca5..332e2f0143 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
@@ -87,7 +87,7 @@ class InfDepexSectionParser(InfParserSectionRoot):
ReFormatComment = re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)
for CommentItem in DepexComment:
CommentContent = CommentItem[0]
- if ReFormatComment.match(CommentContent) != None:
+ if ReFormatComment.match(CommentContent) is not None:
FormatCommentLn = CommentItem[1] + 1
continue
diff --git a/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
index 12ffedaaec..956c116c6e 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
@@ -77,7 +77,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_GUID,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
CommentsList = []
ValueList = []
@@ -164,7 +164,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_PPI,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
ValueList = []
CommentsList = []
@@ -334,7 +334,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_PROTOCOL,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
ValueList = []
CommentsList = []
diff --git a/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
index 210f973f1a..549e67f08d 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
@@ -96,7 +96,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
if LibLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
LibTailComments = LibLineContent[LibLineContent.find(DT.TAB_COMMENT_SPLIT):]
LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]
- if LibLineComment == None:
+ if LibLineComment is None:
LibLineComment = InfLineCommentObject()
LibLineComment.SetTailComments(LibTailComments)
@@ -107,7 +107,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_LIBRARY_CLASS,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
LibLineComment = None
LibHeaderComments = []
diff --git a/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
index 67f1145322..8fb2898826 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
@@ -89,7 +89,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
TailComments = PkgLineContent[PkgLineContent.find(DT.TAB_COMMENT_SPLIT):]
PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]
- if LineComment == None:
+ if LineComment is None:
LineComment = InfLineCommentObject()
LineComment.SetTailComments(TailComments)
#
@@ -99,7 +99,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_META_DATA_PACKAGE,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
LineComment = None
HeaderComments = []
diff --git a/BaseTools/Source/Python/UPT/Parser/InfParser.py b/BaseTools/Source/Python/UPT/Parser/InfParser.py
index e7bef2e35e..7bea49e0e8 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfParser.py
@@ -97,7 +97,7 @@ class InfParser(InfSectionParser):
#
# Load Inf file if filename is not None
#
- if Filename != None:
+ if Filename is not None:
self.ParseInfFile(Filename)
## Parse INF file
diff --git a/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py b/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
index a416897d27..6a335e8b6c 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
@@ -73,9 +73,9 @@ gINF_SECTION_DEF = {
# @param Flag If the flag set to True, need to skip macros in a quoted string
#
def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):
- if GlobalMacros == None:
+ if GlobalMacros is None:
GlobalMacros = {}
- if SectionMacros == None:
+ if SectionMacros is None:
SectionMacros = {}
FileName = LineInfo[0]
diff --git a/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
index f4324cc2ff..a9b87fdc05 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
@@ -95,7 +95,7 @@ class InfPcdSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_PCD,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
ValueList = []
CommentsList = []
diff --git a/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
index 51db796035..645c2c3414 100644
--- a/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
@@ -86,7 +86,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
if SrcLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
TailComments = SrcLineContent[SrcLineContent.find(DT.TAB_COMMENT_SPLIT):]
SrcLineContent = SrcLineContent[:SrcLineContent.find(DT.TAB_COMMENT_SPLIT)]
- if LineComment == None:
+ if LineComment is None:
LineComment = InfLineCommentObject()
LineComment.SetTailComments(TailComments)
@@ -97,7 +97,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
FileName,
DT.MODEL_EFI_SOURCE_FILE,
self.FileLocalMacros)
- if Name != None:
+ if Name is not None:
SectionMacros[Name] = Value
LineComment = None
HeaderComments = []
diff --git a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
index a151732853..e37a0b6c3b 100644
--- a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
+++ b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
@@ -167,11 +167,11 @@ class InfPomAlignment(ModuleObject):
#
# Convert UEFI/PI version to decimal number
#
- if DefineObj.GetUefiSpecificationVersion() != None:
+ if DefineObj.GetUefiSpecificationVersion() is not None:
__UefiVersion = DefineObj.GetUefiSpecificationVersion().GetValue()
__UefiVersion = ConvertVersionToDecimal(__UefiVersion)
self.SetUefiSpecificationVersion(str(__UefiVersion))
- if DefineObj.GetPiSpecificationVersion() != None:
+ if DefineObj.GetPiSpecificationVersion() is not None:
__PiVersion = DefineObj.GetPiSpecificationVersion().GetValue()
__PiVersion = ConvertVersionToDecimal(__PiVersion)
@@ -186,7 +186,7 @@ class InfPomAlignment(ModuleObject):
# must exist items in INF define section
# MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING
#
- if DefineObj.GetModuleType() == None:
+ if DefineObj.GetModuleType() is None:
Logger.Error("InfParser", FORMAT_INVALID,
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("MODULE_TYPE"), File=self.FullPath)
else:
@@ -205,7 +205,7 @@ class InfPomAlignment(ModuleObject):
Line=DefineObj.ModuleType.CurrentLine.LineNo,
ExtraData=DefineObj.ModuleType.CurrentLine.LineString)
self.LibModuleTypeList.append(ModuleType)
- if DefineObj.GetBaseName() == None:
+ if DefineObj.GetBaseName() is None:
Logger.Error("InfParser", FORMAT_INVALID,
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("BASE_NAME"), File=self.FullPath)
else:
@@ -214,17 +214,17 @@ class InfPomAlignment(ModuleObject):
self.UniFileClassObject = UniFileClassObject([PathClass(DefineObj.GetModuleUniFileName())])
else:
self.UniFileClassObject = None
- if DefineObj.GetInfVersion() == None:
+ if DefineObj.GetInfVersion() is None:
Logger.Error("InfParser", FORMAT_INVALID,
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("INF_VERSION"), File=self.FullPath)
else:
self.SetVersion(DefineObj.GetInfVersion().GetValue())
- if DefineObj.GetFileGuid() == None:
+ if DefineObj.GetFileGuid() is None:
Logger.Error("InfParser", FORMAT_INVALID,
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("FILE_GUID"), File=self.FullPath)
else:
self.SetGuid(DefineObj.GetFileGuid().GetValue())
- if DefineObj.GetVersionString() == None:
+ if DefineObj.GetVersionString() is None:
#
# VERSION_STRING is missing from the [Defines] section, tools must assume that the module's version is 0.
#
@@ -256,7 +256,7 @@ class InfPomAlignment(ModuleObject):
if not (ModuleTypeValue == 'SEC' or ModuleTypeValue == 'PEI_CORE' or ModuleTypeValue == 'PEIM'):
Logger.Error("InfParser", FORMAT_INVALID, ST.ERR_INF_PARSER_DEFINE_SHADOW_INVALID, File=self.FullPath)
- if DefineObj.GetPcdIsDriver() != None:
+ if DefineObj.GetPcdIsDriver() is not None:
self.SetPcdIsDriver(DefineObj.GetPcdIsDriver().GetValue())
#
# LIBRARY_CLASS
@@ -499,7 +499,7 @@ class InfPomAlignment(ModuleObject):
LibraryClass.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
LibraryClass.SetSupModuleList(Item.GetSupModuleList())
HelpStringObj = Item.GetHelpString()
- if HelpStringObj != None:
+ if HelpStringObj is not None:
CommentString = GetHelpStringByRemoveHashKey(HelpStringObj.HeaderComments +
HelpStringObj.TailComments)
HelpTextHeaderObj = CommonObject.TextObject()
diff --git a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
index 042d4784c8..cca70e5640 100644
--- a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
+++ b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
@@ -45,7 +45,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
CustomMakefile = DefineObj.GetCustomMakefile()
UefiHiiResourceSection = DefineObj.GetUefiHiiResourceSection()
- if EdkReleaseVersion != None:
+ if EdkReleaseVersion is not None:
Name = DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION
Value = EdkReleaseVersion.GetValue()
Statement = _GenInfDefineStateMent(EdkReleaseVersion.Comments.GetHeaderComments(),
@@ -54,7 +54,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
EdkReleaseVersion.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if Shadow != None:
+ if Shadow is not None:
Name = DT.TAB_INF_DEFINES_SHADOW
Value = Shadow.GetValue()
Statement = _GenInfDefineStateMent(Shadow.Comments.GetHeaderComments(),
@@ -63,7 +63,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
Shadow.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if DpxSource != None:
+ if DpxSource is not None:
Name = DT.TAB_INF_DEFINES_DPX_SOURCE
for DpxSourceItem in DpxSource:
Value = DpxSourceItem[0]
@@ -73,7 +73,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
DpxSourceItem[1].GetTailComments())
DefinesDictNew[Statement] = ArchString
- if PciVendorId != None:
+ if PciVendorId is not None:
Name = DT.TAB_INF_DEFINES_PCI_VENDOR_ID
Value = PciVendorId.GetValue()
Statement = _GenInfDefineStateMent(PciVendorId.Comments.GetHeaderComments(),
@@ -82,7 +82,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
PciVendorId.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if PciDeviceId != None:
+ if PciDeviceId is not None:
Name = DT.TAB_INF_DEFINES_PCI_DEVICE_ID
Value = PciDeviceId.GetValue()
Statement = _GenInfDefineStateMent(PciDeviceId.Comments.GetHeaderComments(),
@@ -91,7 +91,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
PciDeviceId.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if PciClassCode != None:
+ if PciClassCode is not None:
Name = DT.TAB_INF_DEFINES_PCI_CLASS_CODE
Value = PciClassCode.GetValue()
Statement = _GenInfDefineStateMent(PciClassCode.Comments.GetHeaderComments(),
@@ -100,7 +100,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
PciClassCode.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if PciRevision != None:
+ if PciRevision is not None:
Name = DT.TAB_INF_DEFINES_PCI_REVISION
Value = PciRevision.GetValue()
Statement = _GenInfDefineStateMent(PciRevision.Comments.GetHeaderComments(),
@@ -109,7 +109,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
PciRevision.Comments.GetTailComments())
DefinesDictNew[Statement] = ArchString
- if PciCompress != None:
+ if PciCompress is not None:
Name = DT.TAB_INF_DEFINES_PCI_COMPRESS
Value = PciCompress.GetValue()
Statement = _GenInfDefineStateMent(PciCompress.Comments.GetHeaderComments(),
@@ -138,7 +138,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
DefinesDictNew[Statement] = ArchString
- if UefiHiiResourceSection != None:
+ if UefiHiiResourceSection is not None:
Name = DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION
Value = UefiHiiResourceSection.GetValue()
HeaderComment = UefiHiiResourceSection.Comments.GetHeaderComments()
diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py
index 325b96bf56..09653cdce9 100644
--- a/BaseTools/Source/Python/UPT/UPT.py
+++ b/BaseTools/Source/Python/UPT/UPT.py
@@ -90,7 +90,7 @@ def SetLogLevel(Opt):
Logger.SetLevel(Logger.VERBOSE)
elif Opt.opt_quiet:
Logger.SetLevel(Logger.QUIET + 1)
- elif Opt.debug_level != None:
+ elif Opt.debug_level is not None:
if Opt.debug_level < 0 or Opt.debug_level > 9:
Logger.Warn("UPT", ST.ERR_DEBUG_LEVEL)
Logger.SetLevel(Logger.INFO)
diff --git a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
index 4dc1c7edab..51ac48aca5 100644
--- a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
+++ b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
@@ -550,7 +550,7 @@ class ModulePropertyXml(object):
Hob = Axml.FromXml(SubItem, 'HOB')
self.HOBs.append(Hob)
- if Header == None:
+ if Header is None:
Header = ModuleObject()
Header.SetModuleType(self.ModuleType)
diff --git a/BaseTools/Source/Python/UPT/Xml/XmlParser.py b/BaseTools/Source/Python/UPT/Xml/XmlParser.py
index 58959081d0..dba3b7f589 100644
--- a/BaseTools/Source/Python/UPT/Xml/XmlParser.py
+++ b/BaseTools/Source/Python/UPT/Xml/XmlParser.py
@@ -162,7 +162,7 @@ class DistributionPackageXml(object):
def FromXml(self, Filename=None):
- if Filename != None:
+ if Filename is not None:
self.DistP = DistributionPackageClass()
#
# Load to XML
@@ -227,7 +227,7 @@ class DistributionPackageXml(object):
def ToXml(self, DistP):
if self.DistP:
pass
- if DistP != None:
+ if DistP is not None:
#
# Parse DistributionPackageHeader
#
@@ -344,7 +344,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['Guids']
for Item in Module.GetGuidList():
- if Item == None:
+ if Item is None:
CheckDict = {'GuidCName':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -369,7 +369,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['Protocols']
for Item in Module.GetProtocolList():
- if Item == None:
+ if Item is None:
CheckDict = {'Protocol':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -384,7 +384,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['PPIs']
for Item in Module.GetPpiList():
- if Item == None:
+ if Item is None:
CheckDict = {'Ppi':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -399,7 +399,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['PcdCoded']
for Item in Module.GetPcdList():
- if Item == None:
+ if Item is None:
CheckDict = {'PcdEntry':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -416,7 +416,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['Externs']
for Item in Module.GetExternList():
- if Item == None:
+ if Item is None:
CheckDict = {'Extern':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -536,7 +536,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['LibraryClassDefinitions']
for Item in Module.GetLibraryClassList():
- if Item == None:
+ if Item is None:
CheckDict = {'LibraryClass':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -608,7 +608,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['SourceFiles']
for Item in Module.GetSourceFileList():
- if Item == None:
+ if Item is None:
CheckDict = {'Filename':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -636,7 +636,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
#
XmlTreeLevel = TopXmlTreeLevel + ['PackageDependencies']
for Item in Module.GetPackageDependencyList():
- if Item == None:
+ if Item is None:
CheckDict = {'Package':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -649,7 +649,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
# Check BinaryFiles -> BinaryFile
#
for Item in Module.GetBinaryFileList():
- if Item == None:
+ if Item is None:
XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles']
CheckDict = {'BinaryFile':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -772,7 +772,7 @@ def ValidatePS1(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ClonedFrom']
for Item in Package.GetClonedFromList():
- if Item == None:
+ if Item is None:
CheckDict = Sdict()
CheckDict['GUID'] = ''
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -787,7 +787,7 @@ def ValidatePS1(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'LibraryClassDeclarations']
for Item in Package.GetLibraryClassList():
- if Item == None:
+ if Item is None:
CheckDict = {'LibraryClass':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -802,7 +802,7 @@ def ValidatePS1(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'IndustryStandardIncludes']
for Item in Package.GetStandardIncludeFileList():
- if Item == None:
+ if Item is None:
CheckDict = {'IndustryStandardHeader':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -816,7 +816,7 @@ def ValidatePS1(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PackageIncludes']
for Item in Package.GetPackageIncludeFileList():
- if Item == None:
+ if Item is None:
CheckDict = {'PackageHeader':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -842,7 +842,7 @@ def ValidatePS2(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'GuidDeclarations']
for Item in Package.GetGuidList():
- if Item == None:
+ if Item is None:
CheckDict = {'Entry':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -857,7 +857,7 @@ def ValidatePS2(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ProtocolDeclarations']
for Item in Package.GetProtocolList():
- if Item == None:
+ if Item is None:
CheckDict = {'Entry':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -872,7 +872,7 @@ def ValidatePS2(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PpiDeclarations']
for Item in Package.GetPpiList():
- if Item == None:
+ if Item is None:
CheckDict = {'Entry':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
@@ -887,7 +887,7 @@ def ValidatePS2(Package):
#
XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PcdDeclarations']
for Item in Package.GetPcdList():
- if Item == None:
+ if Item is None:
CheckDict = {'PcdEntry':''}
IsRequiredItemListNull(CheckDict, XmlTreeLevel)