BaseTools: Remove equality operator with None
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Mon, 26 Mar 2018 20:25:43 +0000 (04:25 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 30 Mar 2018 00:25:13 +0000 (08:25 +0800)
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>
131 files changed:
BaseTools/Scripts/PackageDocumentTools/packagedoc_cli.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/efibinary.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/message.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dec.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/doxygengen_spec.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/dsc.py
BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/BuildEngine.py
BaseTools/Source/Python/AutoGen/GenC.py
BaseTools/Source/Python/AutoGen/GenDepex.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/AutoGen/GenPcdDb.py
BaseTools/Source/Python/AutoGen/IdfClassObject.py
BaseTools/Source/Python/AutoGen/StrGather.py
BaseTools/Source/Python/AutoGen/UniClassObject.py
BaseTools/Source/Python/BPDG/BPDG.py
BaseTools/Source/Python/BPDG/GenVpd.py
BaseTools/Source/Python/Common/DecClassObject.py
BaseTools/Source/Python/Common/Dictionary.py
BaseTools/Source/Python/Common/DscClassObject.py
BaseTools/Source/Python/Common/EdkIIWorkspace.py
BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py
BaseTools/Source/Python/Common/EdkLogger.py
BaseTools/Source/Python/Common/FdfClassObject.py
BaseTools/Source/Python/Common/FdfParserLite.py
BaseTools/Source/Python/Common/InfClassObject.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Common/Parsing.py
BaseTools/Source/Python/Common/String.py
BaseTools/Source/Python/Common/TargetTxtClassObject.py
BaseTools/Source/Python/Common/ToolDefClassObject.py
BaseTools/Source/Python/Common/VpdInfoFile.py
BaseTools/Source/Python/CommonDataClass/CommonClass.py
BaseTools/Source/Python/Ecc/CParser.py
BaseTools/Source/Python/Ecc/Check.py
BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
BaseTools/Source/Python/Ecc/Ecc.py
BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py
BaseTools/Source/Python/Ecc/c.py
BaseTools/Source/Python/Eot/CParser.py
BaseTools/Source/Python/Eot/CodeFragmentCollector.py
BaseTools/Source/Python/Eot/Eot.py
BaseTools/Source/Python/Eot/FvImage.py
BaseTools/Source/Python/Eot/InfParserLite.py
BaseTools/Source/Python/Eot/Report.py
BaseTools/Source/Python/GenFds/AprioriSection.py
BaseTools/Source/Python/GenFds/Capsule.py
BaseTools/Source/Python/GenFds/CompressSection.py
BaseTools/Source/Python/GenFds/DataSection.py
BaseTools/Source/Python/GenFds/DepexSection.py
BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsFileStatement.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/FvImageSection.py
BaseTools/Source/Python/GenFds/GenFds.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools/Source/Python/GenFds/GuidSection.py
BaseTools/Source/Python/GenFds/OptRomFileStatement.py
BaseTools/Source/Python/GenFds/OptRomInfStatement.py
BaseTools/Source/Python/GenFds/OptionRom.py
BaseTools/Source/Python/GenFds/Region.py
BaseTools/Source/Python/GenFds/Section.py
BaseTools/Source/Python/GenFds/UiSection.py
BaseTools/Source/Python/GenFds/VerSection.py
BaseTools/Source/Python/GenFds/Vtf.py
BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
BaseTools/Source/Python/TargetTool/TargetTool.py
BaseTools/Source/Python/Trim/Trim.py
BaseTools/Source/Python/UPT/Core/DependencyRules.py
BaseTools/Source/Python/UPT/Core/IpiDb.py
BaseTools/Source/Python/UPT/Core/PackageFile.py
BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
BaseTools/Source/Python/UPT/InstallPkg.py
BaseTools/Source/Python/UPT/Library/CommentParsing.py
BaseTools/Source/Python/UPT/Library/Misc.py
BaseTools/Source/Python/UPT/Library/ParserValidate.py
BaseTools/Source/Python/UPT/Library/Parsing.py
BaseTools/Source/Python/UPT/Library/String.py
BaseTools/Source/Python/UPT/Library/UniClassObject.py
BaseTools/Source/Python/UPT/Library/Xml/XmlRoutines.py
BaseTools/Source/Python/UPT/Logger/Log.py
BaseTools/Source/Python/UPT/MkPkg.py
BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfHeaderObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py
BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
BaseTools/Source/Python/UPT/Parser/InfDepexSectionParser.py
BaseTools/Source/Python/UPT/Parser/InfGuidPpiProtocolSectionParser.py
BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
BaseTools/Source/Python/UPT/Parser/InfPackageSectionParser.py
BaseTools/Source/Python/UPT/Parser/InfParser.py
BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
BaseTools/Source/Python/UPT/Parser/InfPcdSectionParser.py
BaseTools/Source/Python/UPT/Parser/InfSourceSectionParser.py
BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignmentMisc.py
BaseTools/Source/Python/UPT/UPT.py
BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
BaseTools/Source/Python/UPT/Xml/XmlParser.py
BaseTools/Source/Python/Workspace/BuildClassObject.py
BaseTools/Source/Python/Workspace/DecBuildData.py
BaseTools/Source/Python/Workspace/DscBuildData.py
BaseTools/Source/Python/Workspace/InfBuildData.py
BaseTools/Source/Python/Workspace/MetaDataTable.py
BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools/Source/Python/Workspace/MetaFileTable.py
BaseTools/Source/Python/Workspace/WorkspaceCommon.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools/Source/Python/build/BuildReport.py
BaseTools/Source/Python/build/build.py

index 92ee6997827726728b19ea5fd0f0589fe414a296..557ffa4505e4e9fa156c7b246bae526bc12a3dcd 100644 (file)
@@ -49,18 +49,18 @@ def parseCmdArgs():
 \r
     # validate the options\r
     errors = []\r
-    if options.WorkspacePath == None:\r
+    if options.WorkspacePath is None:\r
         errors.append('- Please specify workspace path via option -w!')\r
     elif not os.path.exists(options.WorkspacePath):\r
         errors.append("- Invalid workspace path %s! The workspace path should be exist in absolute path!" % options.WorkspacePath)\r
 \r
-    if options.PackagePath == None:\r
+    if options.PackagePath is None:\r
         errors.append('- Please specify package DEC file path via option -p!')\r
     elif not os.path.exists(options.PackagePath):\r
         errors.append("- Invalid package's DEC file path %s! The DEC path should be exist in absolute path!" % options.PackagePath)\r
 \r
     default = "C:\\Program Files\\doxygen\\bin\\doxygen.exe"\r
-    if options.DoxygenPath == None:\r
+    if options.DoxygenPath is None:\r
         if os.path.exists(default):\r
             print "Warning: Assume doxygen tool is installed at %s. If not, please specify via -x" % default\r
             options.DoxygenPath = default\r
@@ -69,7 +69,7 @@ def parseCmdArgs():
     elif not os.path.exists(options.DoxygenPath):\r
         errors.append("- Invalid doxygen tool path %s! The doxygen tool path should be exist in absolute path!" % options.DoxygenPath)\r
 \r
-    if options.OutputPath != None:\r
+    if options.OutputPath is not None:\r
         if not os.path.exists(options.OutputPath):\r
             # create output\r
             try:\r
@@ -77,7 +77,7 @@ def parseCmdArgs():
             except:\r
                 errors.append('- Fail to create the output directory %s' % options.OutputPath)\r
     else:\r
-        if options.PackagePath != None and os.path.exists(options.PackagePath):\r
+        if options.PackagePath is not None and os.path.exists(options.PackagePath):\r
             dirpath = os.path.dirname(options.PackagePath)\r
             default = os.path.join (dirpath, "Document")\r
             print 'Warning: Assume document output at %s. If not, please specify via option -o' % default\r
@@ -90,21 +90,21 @@ def parseCmdArgs():
         else:\r
             errors.append('- Please specify document output path via option -o!')\r
 \r
-    if options.Arch == None:\r
+    if options.Arch is None:\r
         options.Arch = 'ALL'\r
         print "Warning: Assume arch is \"ALL\". If not, specify via -a"\r
 \r
-    if options.DocumentMode == None:\r
+    if options.DocumentMode is None:\r
         options.DocumentMode = "HTML"\r
         print "Warning: Assume document mode is \"HTML\". If not, specify via -m"\r
 \r
-    if options.IncludeOnly == None:\r
+    if options.IncludeOnly is None:\r
         options.IncludeOnly = False\r
         print "Warning: Assume generate package document for all package\'s source including publich interfaces and implementation libraries and modules."\r
 \r
     if options.DocumentMode.lower() == 'chm':\r
         default = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"\r
-        if options.HtmlWorkshopPath == None:\r
+        if options.HtmlWorkshopPath is None:\r
             if os.path.exists(default):\r
                 print 'Warning: Assume the installation path of Microsoft HTML Workshop is %s. If not, specify via option -c.' % default\r
                 options.HtmlWorkshopPath = default\r
@@ -382,7 +382,7 @@ if __name__ == '__main__':
 \r
     # create package model object firstly\r
     pkgObj = createPackageObject(wspath, pkgpath)\r
-    if pkgObj == None:\r
+    if pkgObj is None:\r
         sys.exit(-1)\r
 \r
     # create doxygen action model\r
index 2d0cc9d96e1f51a193c0e79ca6b725b468423208..488949f24b6fcfc04cdae219156e4ab1355c4367 100644 (file)
@@ -58,7 +58,7 @@ class Page(BaseDoxygeItem):
         return subpage\r
 \r
     def AddPages(self, pageArray):\r
-        if pageArray == None:\r
+        if pageArray is None:\r
             return\r
         for page in pageArray:\r
             self.AddPage(page)\r
@@ -370,7 +370,7 @@ class DoxygenConfigFile:
         self.mWarningFile = str.replace('\\', '/')\r
 \r
     def FileExists(self, path):\r
-        if path == None:\r
+        if path is None:\r
             return False\r
         if len(path) == 0:\r
             return False\r
@@ -382,7 +382,7 @@ class DoxygenConfigFile:
         return False\r
 \r
     def AddFile(self, path):\r
-        if path == None:\r
+        if path is None:\r
             return\r
 \r
         if len(path) == 0:\r
index 72becedb8e4e16211b6c7207ccb0172eae507ad9..9db16a63c07a4d64a7bf013a84edd73065caf1f6 100644 (file)
@@ -553,7 +553,7 @@ class EfiFvMapFile(object):
             if line[0] != ' ':\r
                 # new entry\r
                 ret = rMapEntry.match(line)\r
-                if ret != None:\r
+                if ret is not None:\r
                     name     = ret.groups()[0]\r
                     baseaddr = int(ret.groups()[1], 16)\r
                     entry    = int(ret.groups()[2], 16)\r
index 515e7a4fa7dd097fd9957c3bdd616dbe6d17380a..bf1040d6bac4465787c170b759d3d4cee3ab2f09 100644 (file)
@@ -34,7 +34,7 @@ class BaseINIFile(object):
         if key not in cls._objs.keys():\r
             cls._objs[key] = object.__new__(cls, *args, **kwargs)\r
 \r
-        if parent != None:\r
+        if parent is not None:\r
             cls._objs[key].AddParent(parent)\r
 \r
         return cls._objs[key]\r
@@ -47,7 +47,7 @@ class BaseINIFile(object):
         self._isModify = True\r
 \r
     def AddParent(self, parent):\r
-        if parent == None: return\r
+        if parent is None: return\r
         if not hasattr(self, "_parents"):\r
             self._parents = []\r
 \r
@@ -122,7 +122,7 @@ class BaseINIFile(object):
                 continue\r
 \r
             m = section_re.match(templine)\r
-            if m!= None: # found a section\r
+            if mis not None: # found a section\r
                 inGlobal = False\r
                 # Finish the latest section first\r
                 if len(sObjs) != 0:\r
@@ -165,7 +165,7 @@ class BaseINIFile(object):
     def Destroy(self, parent):\r
 \r
         # check referenced parent\r
-        if parent != None:\r
+        if parent is not None:\r
             assert parent in self._parents, "when destory ini object, can not found parent reference!"\r
             self._parents.remove(parent)\r
 \r
@@ -307,7 +307,7 @@ class BaseINISection(object):
                 visit += 1\r
                 continue\r
             line = line.split('#')[0].strip()\r
-            if iniObj != None:\r
+            if iniObj is not None:\r
                 if line.endswith('}'):\r
                     iniObj._end = visit - self._start\r
                     if not iniObj.Parse():\r
index 5cf2028573764a910e7f4009d1d05db5c7e84f8c..51de5cb74e3cf79e9bab1e29859fb94b5f3c9b0d 100644 (file)
@@ -35,14 +35,14 @@ def WarnMsg(mess, fName=None, fNo=None):
 def NormalMessage(type, mess, fName=None, fNo=None):\r
     strMsg = type\r
 \r
-    if fName != None:\r
+    if fName is not None:\r
         strMsg += ' %s' % fName.replace('/', '\\')\r
-        if fNo != None:\r
+        if fNo is not None:\r
             strMsg += '(%d):' % fNo\r
         else:\r
             strMsg += ' :'\r
 \r
-    if fName == None and fNo == None:\r
+    if fName is None and fNo is None:\r
         strMsg += ' '\r
     strMsg += mess\r
 \r
index 05fa2529be2d2e7a959a238da39638b8e6b07960..7c120d85c255995e9b2d8adc1ae9fd55036b9d40 100644 (file)
@@ -74,7 +74,7 @@ class SurfaceObject(object):
 \r
     def Load(self, relativePath):\r
         # if has been loaded, directly return\r
-        if self._fileObj != None: return True\r
+        if self._fileObj is not None: return True\r
 \r
         relativePath = os.path.normpath(relativePath)\r
         fullPath = os.path.join(self._workspace, relativePath)\r
@@ -160,7 +160,7 @@ class Platform(SurfaceObject):
         return dsc.DSCFile\r
 \r
     def GetModuleCount(self):\r
-        if self.GetFileObj() == None:\r
+        if self.GetFileObj() is None:\r
             ErrorMsg("Fail to get module count because DSC file has not been load!")\r
 \r
         return len(self.GetFileObj().GetComponents())\r
@@ -171,7 +171,7 @@ class Platform(SurfaceObject):
     def LoadModules(self, precallback=None, postcallback=None):\r
         for obj in self.GetFileObj().GetComponents():\r
             mFilename = obj.GetFilename()\r
-            if precallback != None:\r
+            if precallback is not None:\r
                 precallback(self, mFilename)\r
             arch = obj.GetArch()\r
             if arch.lower() == 'common':\r
@@ -182,7 +182,7 @@ class Platform(SurfaceObject):
                 module = Module(self, self.GetWorkspace())\r
                 if module.Load(mFilename, arch, obj.GetOveridePcds(), obj.GetOverideLibs()):\r
                     self._modules.append(module)\r
-                    if postcallback != None:\r
+                    if postcallback is not None:\r
                         postcallback(self, module)\r
                 else:\r
                     del module\r
@@ -222,7 +222,7 @@ class Platform(SurfaceObject):
         for obj in objs:\r
             if obj.GetPcdName().lower() == name.lower():\r
                 arr.append(obj)\r
-        if arch != None:\r
+        if arch is not None:\r
             arr = self.FilterObjsByArch(arr, arch)\r
         return arr\r
 \r
@@ -292,7 +292,7 @@ class Platform(SurfaceObject):
             newSect = newDsc.AddNewSection(oldSect.GetName())\r
             for oldComObj in oldSect.GetObjects():\r
                 module = self.GetModuleObject(oldComObj.GetFilename(), oldSect.GetArch())\r
-                if module == None: continue\r
+                if module is None: continue\r
 \r
                 newComObj = dsc.DSCComponentObject(newSect)\r
                 newComObj.SetFilename(oldComObj.GetFilename())\r
@@ -300,7 +300,7 @@ class Platform(SurfaceObject):
                 # add all library instance for override section\r
                 libdict = module.GetLibraries()\r
                 for libclass in libdict.keys():\r
-                    if libdict[libclass] != None:\r
+                    if libdict[libclass] is not None:\r
                         newComObj.AddOverideLib(libclass, libdict[libclass].GetRelativeFilename().replace('\\', '/'))\r
 \r
                 # add all pcds for override section\r
@@ -338,7 +338,7 @@ class Module(SurfaceObject):
 \r
     def Destroy(self):\r
         for lib in self._libs.values():\r
-            if lib != None:\r
+            if lib is not None:\r
                 lib.Destroy()\r
         self._libs.clear()\r
 \r
@@ -351,12 +351,12 @@ class Module(SurfaceObject):
         del self._ppis[:]\r
 \r
         for protocol in self._protocols:\r
-            if protocol != None:\r
+            if protocol is not None:\r
                 protocol.DeRef(self)\r
         del self._protocols[:]\r
 \r
         for guid in self._guids:\r
-            if guid != None:\r
+            if guid is not None:\r
                 guid.DeRef(self)\r
         del self._guids[:]\r
 \r
@@ -375,9 +375,9 @@ class Module(SurfaceObject):
             return False\r
 \r
         self._arch = arch\r
-        if overidePcds != None:\r
+        if overidePcds is not None:\r
             self._overideLibs = overideLibs\r
-        if overideLibs != None:\r
+        if overideLibs is not None:\r
             self._overidePcds = overidePcds\r
 \r
         self._SearchLibraries()\r
@@ -403,7 +403,7 @@ class Module(SurfaceObject):
     def GetPcds(self):\r
         pcds = self._pcds.copy()\r
         for lib in self._libs.values():\r
-            if lib == None: continue\r
+            if lib is None: continue\r
             for name in lib._pcds.keys():\r
                 pcds[name] = lib._pcds[name]\r
         return pcds\r
@@ -412,7 +412,7 @@ class Module(SurfaceObject):
         ppis = []\r
         ppis += self._ppis\r
         for lib in self._libs.values():\r
-            if lib == None: continue\r
+            if lib is None: continue\r
             ppis += lib._ppis\r
         return ppis\r
 \r
@@ -420,7 +420,7 @@ class Module(SurfaceObject):
         pros = []\r
         pros = self._protocols\r
         for lib in self._libs.values():\r
-            if lib == None: continue\r
+            if lib is None: continue\r
             pros += lib._protocols\r
         return pros\r
 \r
@@ -428,7 +428,7 @@ class Module(SurfaceObject):
         guids = []\r
         guids += self._guids\r
         for lib in self._libs.values():\r
-            if lib == None: continue\r
+            if lib is None: continue\r
             guids += lib._guids\r
         return guids\r
 \r
@@ -436,12 +436,12 @@ class Module(SurfaceObject):
         deps = []\r
         deps += self._depexs\r
         for lib in self._libs.values():\r
-            if lib == None: continue\r
+            if lib is None: continue\r
             deps += lib._depexs\r
         return deps\r
 \r
     def IsLibrary(self):\r
-        return self.GetFileObj().GetDefine("LIBRARY_CLASS") != None\r
+        return self.GetFileObj().GetDefine("LIBRARY_CLASS") is not None\r
 \r
     def GetLibraryInstance(self, classname, arch, type):\r
         if classname not in self._libs.keys():\r
@@ -454,7 +454,7 @@ class Module(SurfaceObject):
             parent = self.GetParent()\r
             if issubclass(parent.__class__, Platform):\r
                 path = parent.GetLibraryPath(classname, arch, type)\r
-                if path == None:\r
+                if path is None:\r
                     ErrorMsg('Fail to get library instance for %s' % classname, self.GetFilename())\r
                     return None\r
                 self._libs[classname] = Library(self, self.GetWorkspace())\r
@@ -477,7 +477,7 @@ class Module(SurfaceObject):
                 continue\r
             classname = obj.GetClass()\r
             instance = self.GetLibraryInstance(classname, arch, type)\r
-            if not self.IsLibrary() and instance != None:\r
+            if not self.IsLibrary() and instance is not None:\r
                 instance._isInherit = False\r
 \r
             if classname not in self._libs.keys():\r
@@ -490,7 +490,7 @@ class Module(SurfaceObject):
         pros  = []\r
         deps  = []\r
         guids = []\r
-        if self.GetFileObj() != None:\r
+        if self.GetFileObj() is not None:\r
             pcds = self.FilterObjsByArch(self.GetFileObj().GetSectionObjectsByName('pcd'),\r
                                           self.GetArch())\r
             for pcd in pcds:\r
@@ -534,31 +534,31 @@ class Module(SurfaceObject):
         objs = self.GetFileObj().GetSectionObjectsByName('packages')\r
         for obj in objs:\r
             package = self.GetPlatform().GetPackage(obj.GetPath())\r
-            if package != None:\r
+            if package is not None:\r
                 self._packages.append(package)\r
 \r
     def GetPackages(self):\r
         return self._packages\r
 \r
     def GetPcdObjects(self):\r
-        if self.GetFileObj() == None:\r
+        if self.GetFileObj() is None:\r
             return []\r
 \r
         return self.GetFileObj().GetSectionObjectsByName('pcd')\r
 \r
     def GetLibraryClassHeaderFilePath(self):\r
         lcname = self.GetFileObj().GetProduceLibraryClass()\r
-        if lcname == None: return None\r
+        if lcname is None: return None\r
 \r
         pkgs = self.GetPackages()\r
         for package in pkgs:\r
             path = package.GetLibraryClassHeaderPathByName(lcname)\r
-            if path != None:\r
+            if path is not None:\r
                 return os.path.realpath(os.path.join(package.GetFileObj().GetPackageRootPath(), path))\r
         return None\r
 \r
     def Reload(self, force=False, callback=None):\r
-        if callback != None:\r
+        if callback is not None:\r
             callback(self, "Starting reload...")\r
 \r
         ret = SurfaceObject.Reload(self, force)\r
@@ -568,7 +568,7 @@ class Module(SurfaceObject):
             return True\r
 \r
         for lib in self._libs.values():\r
-            if lib != None:\r
+            if lib is not None:\r
                 lib.Destroy()\r
         self._libs.clear()\r
 \r
@@ -591,13 +591,13 @@ class Module(SurfaceObject):
         del self._packages[:]\r
         del self._depexs[:]\r
 \r
-        if callback != None:\r
+        if callback is not None:\r
             callback(self, "Searching libraries...")\r
         self._SearchLibraries()\r
-        if callback != None:\r
+        if callback is not None:\r
             callback(self, "Searching packages...")\r
         self._SearchPackage()\r
-        if callback != None:\r
+        if callback is not None:\r
             callback(self, "Searching surface items...")\r
         self._SearchSurfaceItems()\r
 \r
@@ -665,16 +665,16 @@ class Package(SurfaceObject):
 \r
     def Destroy(self):\r
         for pcd in self._pcds.values():\r
-            if pcd != None:\r
+            if pcd is not None:\r
                 pcd.Destroy()\r
         for guid in self._guids.values():\r
-            if guid != None:\r
+            if guid is not None:\r
                 guid.Destroy()\r
         for protocol in self._protocols.values():\r
-            if protocol != None:\r
+            if protocol is not None:\r
                 protocol.Destroy()\r
         for ppi in self._ppis.values():\r
-            if ppi != None:\r
+            if ppi is not None:\r
                 ppi.Destroy()\r
         self._pcds.clear()\r
         self._guids.clear()\r
@@ -689,7 +689,7 @@ class Package(SurfaceObject):
         pcds = self.GetFileObj().GetSectionObjectsByName('pcds')\r
         for pcd in pcds:\r
             if pcd.GetPcdName() in self._pcds.keys():\r
-                if self._pcds[pcd.GetPcdName()] != None:\r
+                if self._pcds[pcd.GetPcdName()] is not None:\r
                     self._pcds[pcd.GetPcdName()].AddDecObj(pcd)\r
             else:\r
                 self._pcds[pcd.GetPcdName()] = PcdItem(pcd.GetPcdName(), self, pcd)\r
@@ -726,7 +726,7 @@ class Package(SurfaceObject):
     def GetPcdDefineObjs(self, name=None):\r
         arr = []\r
         objs = self.GetFileObj().GetSectionObjectsByName('pcds')\r
-        if name == None: return objs\r
+        if name is None: return objs\r
 \r
         for obj in objs:\r
             if obj.GetPcdName().lower() == name.lower():\r
@@ -772,7 +772,7 @@ class ModulePcd(object):
 \r
     def __init__(self, parent, name, infObj, pcdItem):\r
         assert issubclass(parent.__class__, Module), "Module's PCD's parent must be module!"\r
-        assert pcdItem != None, 'Pcd %s does not in some package!' % name\r
+        assert pcdItem is not None, 'Pcd %s does not in some package!' % name\r
 \r
         self._name          = name\r
         self._parent        = parent\r
index 3bd0b7b58795bb6ac9c6cd2944b3f5cab1c1b47f..9ff0df3851543f62f47076371f0aea4d3d24ee9d 100644 (file)
@@ -77,7 +77,7 @@ class DECSection(ini.BaseINISection):
         return arr[1]\r
 \r
     def IsArchMatch(self, arch):\r
-        if arch == None or self.GetArch() == 'common':\r
+        if arch is None or self.GetArch() == 'common':\r
             return True\r
 \r
         if self.GetArch().lower() != arch.lower():\r
index 268ba5c3bdd05ff54fd9cb6e761e9d60007a1619..94b6588c0ddf43ca2e29546919e1e8ee99c1938c 100644 (file)
@@ -69,7 +69,7 @@ class DoxygenAction:
         self._chmCallback     = None\r
 \r
     def Log(self, message, level='info'):\r
-        if self._log != None:\r
+        if self._log is not None:\r
             self._log(message, level)\r
 \r
     def IsVerbose(self):\r
@@ -94,7 +94,7 @@ class DoxygenAction:
 \r
         self.Log("    >>>>>> Generate doxygen index page file...Zzz...\n")\r
         indexPagePath = self.GenerateIndexPage()\r
-        if indexPagePath == None:\r
+        if indexPagePath is None:\r
             self.Log("Fail to generate index page!\n", 'error')\r
             return False\r
         else:\r
@@ -109,7 +109,7 @@ class DoxygenAction:
         self.Log("    <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)\r
 \r
         # launch doxygen tool to generate document\r
-        if self._doxygenCallback != None:\r
+        if self._doxygenCallback is not None:\r
             self.Log("    >>>>>> Start doxygen process...Zzz...\n")\r
             if not self._doxygenCallback(self._doxPath, configFilePath):\r
                 return False\r
@@ -166,9 +166,9 @@ class PackageDocumentAction(DoxygenAction):
             self._configFile.AddPreDefined('MDE_CPU_ARM')\r
 \r
         namestr = self._pObj.GetName()\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             namestr += '[%s]' % self._arch\r
-        if self._tooltag != None:\r
+        if self._tooltag is not None:\r
             namestr += '[%s]' % self._tooltag\r
         self._configFile.SetProjectName(namestr)\r
         self._configFile.SetStripPath(self._pObj.GetWorkspace())\r
@@ -314,7 +314,7 @@ class PackageDocumentAction(DoxygenAction):
         objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)\r
         if len(objs) == 0: return []\r
 \r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 classPage = doxygen.Page(obj.GetClassName(),\r
                                          "lc_%s" % obj.GetClassName())\r
@@ -399,7 +399,7 @@ class PackageDocumentAction(DoxygenAction):
             mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())\r
             filePath = mo.groups()[0]\r
 \r
-            if filePath == None or len(filePath) == 0:\r
+            if filePath is None or len(filePath) == 0:\r
                 continue\r
 \r
             # find header file in module's path firstly.\r
@@ -417,7 +417,7 @@ class PackageDocumentAction(DoxygenAction):
                     if os.path.exists(incPath):\r
                         fullPath = incPath\r
                         break\r
-                if infObj != None:\r
+                if infObj is not None:\r
                     pkgInfObjs = infObj.GetSectionObjectsByName('packages')\r
                     for obj in  pkgInfObjs:\r
                         decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))\r
@@ -433,10 +433,10 @@ class PackageDocumentAction(DoxygenAction):
                             if os.path.exists(os.path.join(incPath, filePath)):\r
                                 fullPath = os.path.join(os.path.join(incPath, filePath))\r
                                 break\r
-                        if fullPath != None:\r
+                        if fullPath is not None:\r
                             break\r
 \r
-            if fullPath == None and self.IsVerbose():\r
+            if fullPath is None and self.IsVerbose():\r
                 self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')\r
                 return\r
             else:\r
@@ -477,7 +477,7 @@ class PackageDocumentAction(DoxygenAction):
                 typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())\r
                 pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])\r
             typeRoot = typeRootPageDict[obj.GetPcdType()]\r
-            if self._arch != None:\r
+            if self._arch is not None:\r
                 pcdPage = doxygen.Page('%s' % obj.GetPcdName(),\r
                                         'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))\r
                 pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')\r
@@ -573,7 +573,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('GUID', 'guid_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))\r
         else:\r
@@ -626,7 +626,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('PPI', 'ppi_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))\r
         else:\r
@@ -680,7 +680,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))\r
         else:\r
@@ -773,7 +773,7 @@ class PackageDocumentAction(DoxygenAction):
             if not infObj.Parse():\r
                 self.Log('Fail to load INF file %s' % inf)\r
                 continue\r
-            if infObj.GetProduceLibraryClass() != None:\r
+            if infObj.GetProduceLibraryClass() is not None:\r
                 libObjs.append(infObj)\r
             else:\r
                 modObjs.append(infObj)\r
@@ -951,7 +951,7 @@ class PackageDocumentAction(DoxygenAction):
             retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),\r
                                                        workspace,\r
                                                        refDecObjs)\r
-            if retarr != None:\r
+            if retarr is not None:\r
                 pkgname, hPath = retarr\r
             else:\r
                 self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')\r
index 876da1327b26fc1ca35b8eec0485e07d76f5da71..ca55929eda9a747fab68195e39d761c95c1a6aa9 100644 (file)
@@ -66,7 +66,7 @@ class DoxygenAction:
         self._chmCallback     = None\r
 \r
     def Log(self, message, level='info'):\r
-        if self._log != None:\r
+        if self._log is not None:\r
             self._log(message, level)\r
 \r
     def IsVerbose(self):\r
@@ -91,7 +91,7 @@ class DoxygenAction:
 \r
         self.Log("    >>>>>> Generate doxygen index page file...Zzz...\n")\r
         indexPagePath = self.GenerateIndexPage()\r
-        if indexPagePath == None:\r
+        if indexPagePath is None:\r
             self.Log("Fail to generate index page!\n", 'error')\r
             return False\r
         else:\r
@@ -106,7 +106,7 @@ class DoxygenAction:
         self.Log("    <<<<<< Success Save doxygen config file to %s...\n" % configFilePath)\r
 \r
         # launch doxygen tool to generate document\r
-        if self._doxygenCallback != None:\r
+        if self._doxygenCallback is not None:\r
             self.Log("    >>>>>> Start doxygen process...Zzz...\n")\r
             if not self._doxygenCallback(self._doxPath, configFilePath):\r
                 return False\r
@@ -167,9 +167,9 @@ class PackageDocumentAction(DoxygenAction):
             self._configFile.AddPreDefined(macro)\r
 \r
         namestr = self._pObj.GetName()\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             namestr += '[%s]' % self._arch\r
-        if self._tooltag != None:\r
+        if self._tooltag is not None:\r
             namestr += '[%s]' % self._tooltag\r
         self._configFile.SetProjectName(namestr)\r
         self._configFile.SetStripPath(self._pObj.GetWorkspace())\r
@@ -315,7 +315,7 @@ class PackageDocumentAction(DoxygenAction):
         objs = pObj.GetFileObj().GetSectionObjectsByName('libraryclass', self._arch)\r
         if len(objs) == 0: return []\r
 \r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 classPage = doxygen.Page(obj.GetClassName(),\r
                                          "lc_%s" % obj.GetClassName())\r
@@ -401,7 +401,7 @@ class PackageDocumentAction(DoxygenAction):
             mo = re.match(r"^[#\w\s]+[<\"]([\\/\w.]+)[>\"]$", lines[no].strip())\r
             filePath = mo.groups()[0]\r
 \r
-            if filePath == None or len(filePath) == 0:\r
+            if filePath is None or len(filePath) == 0:\r
                 continue\r
 \r
             # find header file in module's path firstly.\r
@@ -419,7 +419,7 @@ class PackageDocumentAction(DoxygenAction):
                     if os.path.exists(incPath):\r
                         fullPath = incPath\r
                         break\r
-                if infObj != None:\r
+                if infObj is not None:\r
                     pkgInfObjs = infObj.GetSectionObjectsByName('packages')\r
                     for obj in  pkgInfObjs:\r
                         decObj = dec.DECFile(os.path.join(pObj.GetWorkspace(), obj.GetPath()))\r
@@ -435,10 +435,10 @@ class PackageDocumentAction(DoxygenAction):
                             if os.path.exists(os.path.join(incPath, filePath)):\r
                                 fullPath = os.path.join(os.path.join(incPath, filePath))\r
                                 break\r
-                        if fullPath != None:\r
+                        if fullPath is not None:\r
                             break\r
 \r
-            if fullPath == None and self.IsVerbose():\r
+            if fullPath is None and self.IsVerbose():\r
                 self.Log('Can not resolve header file %s for file %s in package %s\n' % (filePath, path, pObj.GetFileObj().GetFilename()), 'error')\r
                 return\r
             else:\r
@@ -479,7 +479,7 @@ class PackageDocumentAction(DoxygenAction):
                 typeRootPageDict[obj.GetPcdType()] = doxygen.Page(obj.GetPcdType(), 'pcd_%s_root_page' % obj.GetPcdType())\r
                 pcdRootPage.AddPage(typeRootPageDict[obj.GetPcdType()])\r
             typeRoot = typeRootPageDict[obj.GetPcdType()]\r
-            if self._arch != None:\r
+            if self._arch is not None:\r
                 pcdPage = doxygen.Page('%s' % obj.GetPcdName(),\r
                                         'pcd_%s_%s_%s' % (obj.GetPcdType(), obj.GetArch(), obj.GetPcdName().split('.')[1]))\r
                 pcdPage.AddDescription('<br>\n'.join(obj.GetComment()) + '<br>\n')\r
@@ -575,7 +575,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('GUID', 'guid_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('guids', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GenerateGuidSubPage(pObj, obj, configFile))\r
         else:\r
@@ -628,7 +628,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('PPI', 'ppi_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('ppis', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GeneratePpiSubPage(pObj, obj, configFile))\r
         else:\r
@@ -682,7 +682,7 @@ class PackageDocumentAction(DoxygenAction):
         pageRoot = doxygen.Page('PROTOCOL', 'protocol_root_page')\r
         objs = pObj.GetFileObj().GetSectionObjectsByName('protocols', self._arch)\r
         if len(objs) == 0: return []\r
-        if self._arch != None:\r
+        if self._arch is not None:\r
             for obj in objs:\r
                 pageRoot.AddPage(self._GenerateProtocolSubPage(pObj, obj, configFile))\r
         else:\r
@@ -775,7 +775,7 @@ class PackageDocumentAction(DoxygenAction):
             if not infObj.Parse():\r
                 self.Log('Fail to load INF file %s' % inf)\r
                 continue\r
-            if infObj.GetProduceLibraryClass() != None:\r
+            if infObj.GetProduceLibraryClass() is not None:\r
                 libObjs.append(infObj)\r
             else:\r
                 modObjs.append(infObj)\r
@@ -954,7 +954,7 @@ class PackageDocumentAction(DoxygenAction):
             retarr = self.SearchLibraryClassHeaderFile(lcObj.GetClass(),\r
                                                        workspace,\r
                                                        refDecObjs)\r
-            if retarr != None:\r
+            if retarr is not None:\r
                 pkgname, hPath = retarr\r
             else:\r
                 self.Log('Fail find the library class %s definition from module %s dependent package!' % (lcObj.GetClass(), infObj.GetFilename()), 'error')\r
index f8ed5315618c709fd6eb73bcd5e5a2ec114b666d..0628fa7408261f2463f7c84b1cd4bca750314373 100644 (file)
@@ -189,7 +189,7 @@ class DSCComponentObject(DSCSectionObject):
                 lines.append('    <%s>\n' % key)\r
 \r
                 for name, value in self._OveridePcds[key]:\r
-                    if value != None:\r
+                    if value is not None:\r
                         lines.append('      %s|%s\n' % (name, value))\r
                     else:\r
                         lines.append('      %s\n' % name)\r
index 9d70fbcf97dbfffab08f0c10921cf5fb3587cdc5..32b26850e766fe5835dc8ebf11901b100fd8dffd 100644 (file)
@@ -23,7 +23,7 @@ class INFFile(ini.BaseINIFile):
 \r
     def GetProduceLibraryClass(self):\r
         obj = self.GetDefine("LIBRARY_CLASS")\r
-        if obj == None: return None\r
+        if obj is None: return None\r
 \r
         return obj.split('|')[0].strip()\r
 \r
@@ -59,7 +59,7 @@ class INFFile(ini.BaseINIFile):
         if not ini.BaseINIFile.Parse(self):\r
             return False\r
         classname = self.GetProduceLibraryClass()\r
-        if classname != None:\r
+        if classname is not None:\r
             libobjdict = INFFile._libobjs\r
             if libobjdict.has_key(classname):\r
                 if self not in libobjdict[classname]:\r
@@ -77,7 +77,7 @@ class INFFile(ini.BaseINIFile):
 \r
     def Clear(self):\r
         classname = self.GetProduceLibraryClass()\r
-        if classname != None:\r
+        if classname is not None:\r
             libobjdict = INFFile._libobjs\r
             libobjdict[classname].remove(self)\r
             if len(libobjdict[classname]) == 0:\r
@@ -114,7 +114,7 @@ class INFSection(ini.BaseINISection):
         return arr[1]\r
 \r
     def IsArchMatch(self, arch):\r
-        if arch == None or self.GetArch() == 'common':\r
+        if arch is None or self.GetArch() == 'common':\r
             return True\r
 \r
         if self.GetArch().lower() != arch.lower():\r
@@ -258,9 +258,9 @@ class INFSourceObject(INFSectionObject):
             del objdict[self.mFilename]\r
 \r
     def IsMatchFamily(self, family):\r
-        if family == None:\r
+        if family is None:\r
             return True\r
-        if self.mFamily != None:\r
+        if self.mFamily is not None:\r
             if family.strip().lower() == self.mFamily.lower():\r
                 return True\r
             else:\r
index aeeab9190473c7af9b85819d34c8f164e93644b8..3384fdb70b7ef2b1f292db5992e88ab6ba4a35fc 100644 (file)
@@ -766,7 +766,7 @@ class WorkspaceAutoGen(AutoGen):
         for Fv in Fdf.Profile.FvDict:\r
             _GuidDict = {}\r
             for FfsFile in Fdf.Profile.FvDict[Fv].FfsList:\r
-                if FfsFile.InfFileName and FfsFile.NameGuid == None:\r
+                if FfsFile.InfFileName and FfsFile.NameGuid is None:\r
                     #\r
                     # Get INF file GUID\r
                     #\r
@@ -817,7 +817,7 @@ class WorkspaceAutoGen(AutoGen):
                                                 ExtraData=self.FdfFile)\r
                         InfFoundFlag = False\r
 \r
-                if FfsFile.NameGuid != None:\r
+                if FfsFile.NameGuid is not None:\r
                     _CheckPCDAsGuidPattern = re.compile("^PCD\(.+\..+\)$")\r
 \r
                     #\r
@@ -939,13 +939,13 @@ class WorkspaceAutoGen(AutoGen):
 \r
     ## Return the directory to store FV files\r
     def _GetFvDir(self):\r
-        if self._FvDir == None:\r
+        if self._FvDir is None:\r
             self._FvDir = path.join(self.BuildDir, 'FV')\r
         return self._FvDir\r
 \r
     ## Return the directory to store all intermediate and final files built\r
     def _GetBuildDir(self):\r
-        if self._BuildDir == None:\r
+        if self._BuildDir is None:\r
             return self.AutoGenObjectList[0].BuildDir\r
 \r
     ## Return the build output directory platform specifies\r
@@ -973,7 +973,7 @@ class WorkspaceAutoGen(AutoGen):
     #   @retval     string  Makefile directory\r
     #\r
     def _GetMakeFileDir(self):\r
-        if self._MakeFileDir == None:\r
+        if self._MakeFileDir is None:\r
             self._MakeFileDir = self.BuildDir\r
         return self._MakeFileDir\r
 \r
@@ -982,7 +982,7 @@ class WorkspaceAutoGen(AutoGen):
     #   @retval     string  Build command string\r
     #\r
     def _GetBuildCommand(self):\r
-        if self._BuildCommand == None:\r
+        if self._BuildCommand is None:\r
             # BuildCommand should be all the same. So just get one from platform AutoGen\r
             self._BuildCommand = self.AutoGenObjectList[0].BuildCommand\r
         return self._BuildCommand\r
@@ -1215,7 +1215,7 @@ class PlatformAutoGen(AutoGen):
 \r
         self.VariableInfo = None\r
 \r
-        if GlobalData.gFdfParser != None:\r
+        if GlobalData.gFdfParser is not None:\r
             self._AsBuildInfList = GlobalData.gFdfParser.Profile.InfList\r
             for Inf in self._AsBuildInfList:\r
                 InfClass = PathClass(NormPath(Inf), GlobalData.gWorkspace, self.Arch)\r
@@ -1331,7 +1331,7 @@ class PlatformAutoGen(AutoGen):
             for SkuName in Pcd.SkuInfoList:\r
                 Sku = Pcd.SkuInfoList[SkuName]\r
                 SkuId = Sku.SkuId\r
-                if SkuId == None or SkuId == '':\r
+                if SkuId is None or SkuId == '':\r
                     continue\r
                 if len(Sku.VariableName) > 0:\r
                     VariableGuidStructure = Sku.VariableGuidValue\r
@@ -1642,7 +1642,7 @@ class PlatformAutoGen(AutoGen):
                         # if the offset of a VPD is *, then it need to be fixed up by third party tool.\r
                         if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
                             NeedProcessVpdMapFile = True\r
-                            if self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == '':\r
+                            if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':\r
                                 EdkLogger.error("Build", FILE_NOT_FOUND, \\r
                                                 "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")\r
 \r
@@ -1654,7 +1654,7 @@ class PlatformAutoGen(AutoGen):
             for DscPcd in PlatformPcds:\r
                 DscPcdEntry = self._PlatformPcds[DscPcd]\r
                 if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:\r
-                    if not (self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == ''):\r
+                    if not (self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == ''):\r
                         FoundFlag = False\r
                         for VpdPcd in VpdFile._VpdArray.keys():\r
                             # This PCD has been referenced by module\r
@@ -1734,7 +1734,7 @@ class PlatformAutoGen(AutoGen):
 \r
                                 # if the offset of a VPD is *, then it need to be fixed up by third party tool.\r
                             VpdSkuMap[DscPcd] = SkuValueMap\r
-            if (self.Platform.FlashDefinition == None or self.Platform.FlashDefinition == '') and \\r
+            if (self.Platform.FlashDefinition is None or self.Platform.FlashDefinition == '') and \\r
                VpdFile.GetCount() != 0:\r
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, \r
                                 "Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))\r
@@ -1817,14 +1817,14 @@ class PlatformAutoGen(AutoGen):
                     BPDGToolName = ToolDef["PATH"]\r
                     break\r
             # Call third party GUID BPDG tool.\r
-            if BPDGToolName != None:\r
+            if BPDGToolName is not None:\r
                 VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath)\r
             else:\r
                 EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")\r
 \r
     ## Return the platform build data object\r
     def _GetPlatform(self):\r
-        if self._Platform == None:\r
+        if self._Platform is None:\r
             self._Platform = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]\r
         return self._Platform\r
 \r
@@ -1842,7 +1842,7 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Return the FDF file name\r
     def _GetFdfFile(self):\r
-        if self._FdfFile == None:\r
+        if self._FdfFile is None:\r
             if self.Workspace.FdfFile != "":\r
                 self._FdfFile= mws.join(self.WorkspaceDir, self.Workspace.FdfFile)\r
             else:\r
@@ -1855,7 +1855,7 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Return the directory to store all intermediate and final files built\r
     def _GetBuildDir(self):\r
-        if self._BuildDir == None:\r
+        if self._BuildDir is None:\r
             if os.path.isabs(self.OutputDir):\r
                 self._BuildDir = path.join(\r
                                             path.abspath(self.OutputDir),\r
@@ -1875,7 +1875,7 @@ class PlatformAutoGen(AutoGen):
     #   @retval     string  Makefile directory\r
     #\r
     def _GetMakeFileDir(self):\r
-        if self._MakeFileDir == None:\r
+        if self._MakeFileDir is None:\r
             self._MakeFileDir = path.join(self.BuildDir, self.Arch)\r
         return self._MakeFileDir\r
 \r
@@ -1884,7 +1884,7 @@ class PlatformAutoGen(AutoGen):
     #   @retval     string  Build command string\r
     #\r
     def _GetBuildCommand(self):\r
-        if self._BuildCommand == None:\r
+        if self._BuildCommand is None:\r
             self._BuildCommand = []\r
             if "MAKE" in self.ToolDefinition and "PATH" in self.ToolDefinition["MAKE"]:\r
                 self._BuildCommand += SplitOption(self.ToolDefinition["MAKE"]["PATH"])\r
@@ -1906,7 +1906,7 @@ class PlatformAutoGen(AutoGen):
     #  Get each tool defition for given tool chain from tools_def.txt and platform\r
     #\r
     def _GetToolDefinition(self):\r
-        if self._ToolDefinitions == None:\r
+        if self._ToolDefinitions is None:\r
             ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDictionary\r
             if TAB_TOD_DEFINES_COMMAND_TYPE not in self.Workspace.ToolDef.ToolsDefTxtDatabase:\r
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No tools found in configuration",\r
@@ -1972,13 +1972,13 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Return the paths of tools\r
     def _GetToolDefFile(self):\r
-        if self._ToolDefFile == None:\r
+        if self._ToolDefFile is None:\r
             self._ToolDefFile = os.path.join(self.MakeFileDir, "TOOLS_DEF." + self.Arch)\r
         return self._ToolDefFile\r
 \r
     ## Retrieve the toolchain family of given toolchain tag. Default to 'MSFT'.\r
     def _GetToolChainFamily(self):\r
-        if self._ToolChainFamily == None:\r
+        if self._ToolChainFamily is None:\r
             ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase\r
             if TAB_TOD_DEFINES_FAMILY not in ToolDefinition \\r
                or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \\r
@@ -1991,7 +1991,7 @@ class PlatformAutoGen(AutoGen):
         return self._ToolChainFamily\r
 \r
     def _GetBuildRuleFamily(self):\r
-        if self._BuildRuleFamily == None:\r
+        if self._BuildRuleFamily is None:\r
             ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase\r
             if TAB_TOD_DEFINES_BUILDRULEFAMILY not in ToolDefinition \\r
                or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY] \\r
@@ -2005,19 +2005,19 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Return the build options specific for all modules in this platform\r
     def _GetBuildOptions(self):\r
-        if self._BuildOption == None:\r
+        if self._BuildOption is None:\r
             self._BuildOption = self._ExpandBuildOption(self.Platform.BuildOptions)\r
         return self._BuildOption\r
 \r
     ## Return the build options specific for EDK modules in this platform\r
     def _GetEdkBuildOptions(self):\r
-        if self._EdkBuildOption == None:\r
+        if self._EdkBuildOption is None:\r
             self._EdkBuildOption = self._ExpandBuildOption(self.Platform.BuildOptions, EDK_NAME)\r
         return self._EdkBuildOption\r
 \r
     ## Return the build options specific for EDKII modules in this platform\r
     def _GetEdkIIBuildOptions(self):\r
-        if self._EdkIIBuildOption == None:\r
+        if self._EdkIIBuildOption is None:\r
             self._EdkIIBuildOption = self._ExpandBuildOption(self.Platform.BuildOptions, EDKII_NAME)\r
         return self._EdkIIBuildOption\r
 \r
@@ -2026,7 +2026,7 @@ class PlatformAutoGen(AutoGen):
     #   @retval     BuildRule object\r
     #\r
     def _GetBuildRule(self):\r
-        if self._BuildRule == None:\r
+        if self._BuildRule is None:\r
             BuildRuleFile = None\r
             if TAB_TAT_DEFINES_BUILD_RULE_CONF in self.Workspace.TargetTxt.TargetTxtDictionary:\r
                 BuildRuleFile = self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]\r
@@ -2046,7 +2046,7 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Summarize the packages used by modules in this platform\r
     def _GetPackageList(self):\r
-        if self._PackageList == None:\r
+        if self._PackageList is None:\r
             self._PackageList = set()\r
             for La in self.LibraryAutoGenList:\r
                 self._PackageList.update(La.DependentPackageList)\r
@@ -2071,19 +2071,19 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Get list of non-dynamic PCDs\r
     def _GetNonDynamicPcdList(self):\r
-        if self._NonDynamicPcdList == None:\r
+        if self._NonDynamicPcdList is None:\r
             self.CollectPlatformDynamicPcds()\r
         return self._NonDynamicPcdList\r
 \r
     ## Get list of dynamic PCDs\r
     def _GetDynamicPcdList(self):\r
-        if self._DynamicPcdList == None:\r
+        if self._DynamicPcdList is None:\r
             self.CollectPlatformDynamicPcds()\r
         return self._DynamicPcdList\r
 \r
     ## Generate Token Number for all PCD\r
     def _GetPcdTokenNumbers(self):\r
-        if self._PcdTokenNumber == None:\r
+        if self._PcdTokenNumber is None:\r
             self._PcdTokenNumber = sdict()\r
             TokenNumber = 1\r
             #\r
@@ -2151,13 +2151,13 @@ class PlatformAutoGen(AutoGen):
 \r
     ## Summarize ModuleAutoGen objects of all modules to be built for this platform\r
     def _GetModuleAutoGenList(self):\r
-        if self._ModuleAutoGenList == None:\r
+        if self._ModuleAutoGenList is None:\r
             self._GetAutoGenObjectList()\r
         return self._ModuleAutoGenList\r
 \r
     ## Summarize ModuleAutoGen objects of all libraries to be built for this platform\r
     def _GetLibraryAutoGenList(self):\r
-        if self._LibraryAutoGenList == None:\r
+        if self._LibraryAutoGenList is None:\r
             self._GetAutoGenObjectList()\r
         return self._LibraryAutoGenList\r
 \r
@@ -2221,9 +2221,9 @@ class PlatformAutoGen(AutoGen):
                         LibraryPath = PlatformModule.LibraryClasses[LibraryClassName]\r
                     else:\r
                         LibraryPath = self.Platform.LibraryClasses[LibraryClassName, ModuleType]\r
-                    if LibraryPath == None or LibraryPath == "":\r
+                    if LibraryPath is None or LibraryPath == "":\r
                         LibraryPath = M.LibraryClasses[LibraryClassName]\r
-                        if LibraryPath == None or LibraryPath == "":\r
+                        if LibraryPath is None or LibraryPath == "":\r
                             EdkLogger.error("build", RESOURCE_NOT_AVAILABLE,\r
                                             "Instance of library class [%s] is not found" % LibraryClassName,\r
                                             File=self.MetaFile,\r
@@ -2233,7 +2233,7 @@ class PlatformAutoGen(AutoGen):
                     # for those forced library instance (NULL library), add a fake library class\r
                     if LibraryClassName.startswith("NULL"):\r
                         LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))\r
-                    elif LibraryModule.LibraryClass == None \\r
+                    elif LibraryModule.LibraryClass is None \\r
                          or len(LibraryModule.LibraryClass) == 0 \\r
                          or (ModuleType != 'USER_DEFINED'\r
                              and ModuleType not in LibraryModule.LibraryClass[0].SupModList):\r
@@ -2249,7 +2249,7 @@ class PlatformAutoGen(AutoGen):
                 else:\r
                     LibraryModule = LibraryInstance[LibraryClassName]\r
 \r
-                if LibraryModule == None:\r
+                if LibraryModule is None:\r
                     continue\r
 \r
                 if LibraryModule.ConstructorList != [] and LibraryModule not in Constructor:\r
@@ -2357,7 +2357,7 @@ class PlatformAutoGen(AutoGen):
             if (ToPcd.TokenCName, ToPcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:\r
                 TokenCName = PcdItem[0]\r
                 break\r
-        if FromPcd != None:\r
+        if FromPcd is not None:\r
             if ToPcd.Pending and FromPcd.Type not in [None, '']:\r
                 ToPcd.Type = FromPcd.Type\r
             elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [None, ''])\\r
@@ -2401,7 +2401,7 @@ class PlatformAutoGen(AutoGen):
             ToPcd.validlists = FromPcd.validlists\r
             ToPcd.expressions = FromPcd.expressions\r
 \r
-        if FromPcd != None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:\r
+        if FromPcd is not None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:\r
             EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \\r
                             % (ToPcd.TokenSpaceGuidCName, TokenCName))\r
             Value = ToPcd.DefaultValue\r
@@ -2447,7 +2447,7 @@ class PlatformAutoGen(AutoGen):
                 Sku = PcdInModule.SkuInfoList[SkuId]\r
                 if Sku.VariableGuid == '': continue\r
                 Sku.VariableGuidValue = GuidValue(Sku.VariableGuid, self.PackageList, self.MetaFile.Path)\r
-                if Sku.VariableGuidValue == None:\r
+                if Sku.VariableGuidValue is None:\r
                     PackageList = "\n\t".join([str(P) for P in self.PackageList])\r
                     EdkLogger.error(\r
                                 'build',\r
@@ -2510,12 +2510,12 @@ class PlatformAutoGen(AutoGen):
             M = LibraryConsumerList.pop()\r
             for LibraryName in M.Libraries:\r
                 Library = self.Platform.LibraryClasses[LibraryName, ':dummy:']\r
-                if Library == None:\r
+                if Library is None:\r
                     for Key in self.Platform.LibraryClasses.data.keys():\r
                         if LibraryName.upper() == Key.upper():\r
                             Library = self.Platform.LibraryClasses[Key, ':dummy:']\r
                             break\r
-                    if Library == None:\r
+                    if Library is None:\r
                         EdkLogger.warn("build", "Library [%s] is not found" % LibraryName, File=str(M),\r
                             ExtraData="\t%s [%s]" % (str(Module), self.Arch))\r
                         continue\r
@@ -2570,13 +2570,13 @@ class PlatformAutoGen(AutoGen):
             # Key[1] -- TARGET_TOOLCHAIN_ARCH_COMMANDTYPE_ATTRIBUTE\r
             #\r
             if (Key[0] == self.BuildRuleFamily and\r
-                (ModuleStyle == None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):\r
+                (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):\r
                 Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')\r
                 if Target == self.BuildTarget or Target == "*":\r
                     if ToolChain == self.ToolChain or ToolChain == "*":\r
                         if Arch == self.Arch or Arch == "*":\r
                             if Options[Key].startswith("="):\r
-                                if OverrideList.get(Key[1]) != None:\r
+                                if OverrideList.get(Key[1]) is not None:\r
                                     OverrideList.pop(Key[1])\r
                                 OverrideList[Key[1]] = Options[Key]\r
         \r
@@ -2600,14 +2600,14 @@ class PlatformAutoGen(AutoGen):
                                 if CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*":\r
                                     if Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*":\r
                                         if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):\r
-                                            if Options.get((self.BuildRuleFamily, NextKey)) != None:\r
+                                            if Options.get((self.BuildRuleFamily, NextKey)) is not None:\r
                                                 Options.pop((self.BuildRuleFamily, NextKey))\r
                                         else:\r
-                                            if Options.get((self.BuildRuleFamily, NowKey)) != None:\r
+                                            if Options.get((self.BuildRuleFamily, NowKey)) is not None:\r
                                                 Options.pop((self.BuildRuleFamily, NowKey))\r
                                                            \r
         for Key in Options:\r
-            if ModuleStyle != None and len (Key) > 2:\r
+            if ModuleStyle is not None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
                 # Only append build option for the matched style module.\r
                 if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:\r
@@ -2644,7 +2644,7 @@ class PlatformAutoGen(AutoGen):
             return BuildOptions\r
 \r
         for Key in Options:\r
-            if ModuleStyle != None and len (Key) > 2:\r
+            if ModuleStyle is not None and len (Key) > 2:\r
                 # Check Module style is EDK or EDKII.\r
                 # Only append build option for the matched style module.\r
                 if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:\r
@@ -2736,7 +2736,7 @@ class PlatformAutoGen(AutoGen):
                             BuildOptions[Tool][Attr] += " " + Value\r
                         else:\r
                             BuildOptions[Tool][Attr] = Value\r
-        if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None:\r
+        if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag is not None:\r
             #\r
             # Override UNI flag only for EDK module.\r
             #\r
@@ -2942,7 +2942,7 @@ class ModuleAutoGen(AutoGen):
 \r
     # Macros could be used in build_rule.txt (also Makefile)\r
     def _GetMacros(self):\r
-        if self._Macro == None:\r
+        if self._Macro is None:\r
             self._Macro = sdict()\r
             self._Macro["WORKSPACE"             ] = self.WorkspaceDir\r
             self._Macro["MODULE_NAME"           ] = self.Name\r
@@ -2982,7 +2982,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the module build data object\r
     def _GetModule(self):\r
-        if self._Module == None:\r
+        if self._Module is None:\r
             self._Module = self.Workspace.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]\r
         return self._Module\r
 \r
@@ -3038,8 +3038,8 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Check if the module is library or not\r
     def _IsLibrary(self):\r
-        if self._LibraryFlag == None:\r
-            if self.Module.LibraryClass != None and self.Module.LibraryClass != []:\r
+        if self._LibraryFlag is None:\r
+            if self.Module.LibraryClass is not None and self.Module.LibraryClass != []:\r
                 self._LibraryFlag = True\r
             else:\r
                 self._LibraryFlag = False\r
@@ -3051,7 +3051,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the directory to store intermediate files of the module\r
     def _GetBuildDir(self):\r
-        if self._BuildDir == None:\r
+        if self._BuildDir is None:\r
             self._BuildDir = path.join(\r
                                     self.PlatformInfo.BuildDir,\r
                                     self.Arch,\r
@@ -3063,15 +3063,15 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the directory to store the intermediate object files of the mdoule\r
     def _GetOutputDir(self):\r
-        if self._OutputDir == None:\r
+        if self._OutputDir is None:\r
             self._OutputDir = path.join(self.BuildDir, "OUTPUT")\r
             CreateDirectory(self._OutputDir)\r
         return self._OutputDir\r
 \r
     ## Return the directory to store ffs file\r
     def _GetFfsOutputDir(self):\r
-        if self._FfsOutputDir == None:\r
-            if GlobalData.gFdfParser != None:\r
+        if self._FfsOutputDir is None:\r
+            if GlobalData.gFdfParser is not None:\r
                 self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)\r
             else:\r
                 self._FfsOutputDir = ''\r
@@ -3079,21 +3079,21 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the directory to store auto-gened source files of the mdoule\r
     def _GetDebugDir(self):\r
-        if self._DebugDir == None:\r
+        if self._DebugDir is None:\r
             self._DebugDir = path.join(self.BuildDir, "DEBUG")\r
             CreateDirectory(self._DebugDir)\r
         return self._DebugDir\r
 \r
     ## Return the path of custom file\r
     def _GetCustomMakefile(self):\r
-        if self._CustomMakefile == None:\r
+        if self._CustomMakefile is None:\r
             self._CustomMakefile = {}\r
             for Type in self.Module.CustomMakefile:\r
                 if Type in gMakeTypeMap:\r
                     MakeType = gMakeTypeMap[Type]\r
                 else:\r
                     MakeType = 'nmake'\r
-                if self.SourceOverrideDir != None:\r
+                if self.SourceOverrideDir is not None:\r
                     File = os.path.join(self.SourceOverrideDir, self.Module.CustomMakefile[Type])\r
                     if not os.path.exists(File):\r
                         File = os.path.join(self.SourceDir, self.Module.CustomMakefile[Type])\r
@@ -3194,7 +3194,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list    The token list of the dependency expression after parsed\r
     #\r
     def _GetDepexTokenList(self):\r
-        if self._DepexList == None:\r
+        if self._DepexList is None:\r
             self._DepexList = {}\r
             if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:\r
                 return self._DepexList\r
@@ -3230,7 +3230,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list    The token list of the dependency expression after parsed\r
     #\r
     def _GetDepexExpressionTokenList(self):\r
-        if self._DepexExpressionList == None:\r
+        if self._DepexExpressionList is None:\r
             self._DepexExpressionList = {}\r
             if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:\r
                 return self._DepexExpressionList\r
@@ -3298,7 +3298,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     dict            The dict containing valid options\r
     #\r
     def _GetModuleBuildOption(self):\r
-        if self._BuildOption == None:\r
+        if self._BuildOption is None:\r
             self._BuildOption, self.BuildRuleOrder = self.PlatformInfo.ApplyBuildOption(self.Module)\r
             if self.BuildRuleOrder:\r
                 self.BuildRuleOrder = ['.%s' % Ext for Ext in self.BuildRuleOrder.split()]\r
@@ -3309,7 +3309,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list            The include path list\r
     #\r
     def _GetBuildOptionIncPathList(self):\r
-        if self._BuildOptionIncPathList == None:\r
+        if self._BuildOptionIncPathList is None:\r
             #\r
             # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC/RVCT\r
             # is the former use /I , the Latter used -I to specify include directories\r
@@ -3370,7 +3370,7 @@ class ModuleAutoGen(AutoGen):
     #  $(CONF_DIRECTORY)/build_rule.txt and toolchain family.\r
     #\r
     def _GetSourceFileList(self):\r
-        if self._SourceFileList == None:\r
+        if self._SourceFileList is None:\r
             self._SourceFileList = []\r
             for F in self.Module.Sources:\r
                 # match tool chain\r
@@ -3423,7 +3423,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the list of unicode files\r
     def _GetUnicodeFileList(self):\r
-        if self._UnicodeFileList == None:\r
+        if self._UnicodeFileList is None:\r
             if TAB_UNICODE_FILE in self.FileTypes:\r
                 self._UnicodeFileList = self.FileTypes[TAB_UNICODE_FILE]\r
             else:\r
@@ -3432,7 +3432,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the list of vfr files\r
     def _GetVfrFileList(self):\r
-        if self._VfrFileList == None:\r
+        if self._VfrFileList is None:\r
             if TAB_VFR_FILE in self.FileTypes:\r
                 self._VfrFileList = self.FileTypes[TAB_VFR_FILE]\r
             else:\r
@@ -3441,7 +3441,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Return the list of Image Definition files\r
     def _GetIdfFileList(self):\r
-        if self._IdfFileList == None:\r
+        if self._IdfFileList is None:\r
             if TAB_IMAGE_FILE in self.FileTypes:\r
                 self._IdfFileList = self.FileTypes[TAB_IMAGE_FILE]\r
             else:\r
@@ -3455,7 +3455,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list            The list of files which can be built later\r
     #\r
     def _GetBinaryFiles(self):\r
-        if self._BinaryFileList == None:\r
+        if self._BinaryFileList is None:\r
             self._BinaryFileList = []\r
             for F in self.Module.Binaries:\r
                 if F.Target not in ['COMMON', '*'] and F.Target != self.BuildTarget:\r
@@ -3465,7 +3465,7 @@ class ModuleAutoGen(AutoGen):
         return self._BinaryFileList\r
 \r
     def _GetBuildRules(self):\r
-        if self._BuildRules == None:\r
+        if self._BuildRules is None:\r
             BuildRules = {}\r
             BuildRuleDatabase = self.PlatformInfo.BuildRule\r
             for Type in BuildRuleDatabase.FileTypeList:\r
@@ -3492,7 +3492,7 @@ class ModuleAutoGen(AutoGen):
         return self._BuildRules\r
 \r
     def _ApplyBuildRule(self, File, FileType):\r
-        if self._BuildTargets == None:\r
+        if self._BuildTargets is None:\r
             self._IntroBuildTargetList = set()\r
             self._FinalBuildTargetList = set()\r
             self._BuildTargets = {}\r
@@ -3517,7 +3517,7 @@ class ModuleAutoGen(AutoGen):
             if Source != File:\r
                 CreateDirectory(Source.Dir)\r
 \r
-            if File.IsBinary and File == Source and self._BinaryFileList != None and File in self._BinaryFileList:\r
+            if File.IsBinary and File == Source and self._BinaryFileList is not None and File in self._BinaryFileList:\r
                 # Skip all files that are not binary libraries\r
                 if not self.IsLibrary:\r
                     continue\r
@@ -3569,7 +3569,7 @@ class ModuleAutoGen(AutoGen):
             FileType = TAB_UNKNOWN_FILE\r
 \r
     def _GetTargets(self):\r
-        if self._BuildTargets == None:\r
+        if self._BuildTargets is None:\r
             self._IntroBuildTargetList = set()\r
             self._FinalBuildTargetList = set()\r
             self._BuildTargets = {}\r
@@ -3616,7 +3616,7 @@ class ModuleAutoGen(AutoGen):
         if self.BuildType == 'UEFI_HII':\r
             UniStringAutoGenC = False\r
             IdfStringAutoGenC = False\r
-        if self._AutoGenFileList == None:\r
+        if self._AutoGenFileList is None:\r
             self._AutoGenFileList = {}\r
             AutoGenC = TemplateString()\r
             AutoGenH = TemplateString()\r
@@ -3639,29 +3639,29 @@ class ModuleAutoGen(AutoGen):
                 AutoFile = PathClass(gAutoGenStringFileName % {"module_name":self.Name}, self.DebugDir)\r
                 self._AutoGenFileList[AutoFile] = str(StringH)\r
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
-            if UniStringBinBuffer != None and UniStringBinBuffer.getvalue() != "":\r
+            if UniStringBinBuffer is not None and UniStringBinBuffer.getvalue() != "":\r
                 AutoFile = PathClass(gAutoGenStringFormFileName % {"module_name":self.Name}, self.OutputDir)\r
                 self._AutoGenFileList[AutoFile] = UniStringBinBuffer.getvalue()\r
                 AutoFile.IsBinary = True\r
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
-            if UniStringBinBuffer != None:\r
+            if UniStringBinBuffer is not None:\r
                 UniStringBinBuffer.close()\r
             if str(StringIdf) != "":\r
                 AutoFile = PathClass(gAutoGenImageDefFileName % {"module_name":self.Name}, self.DebugDir)\r
                 self._AutoGenFileList[AutoFile] = str(StringIdf)\r
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
-            if IdfGenBinBuffer != None and IdfGenBinBuffer.getvalue() != "":\r
+            if IdfGenBinBuffer is not None and IdfGenBinBuffer.getvalue() != "":\r
                 AutoFile = PathClass(gAutoGenIdfFileName % {"module_name":self.Name}, self.OutputDir)\r
                 self._AutoGenFileList[AutoFile] = IdfGenBinBuffer.getvalue()\r
                 AutoFile.IsBinary = True\r
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)\r
-            if IdfGenBinBuffer != None:\r
+            if IdfGenBinBuffer is not None:\r
                 IdfGenBinBuffer.close()\r
         return self._AutoGenFileList\r
 \r
     ## Return the list of library modules explicitly or implicityly used by this module\r
     def _GetLibraryList(self):\r
-        if self._DependentLibraryList == None:\r
+        if self._DependentLibraryList is None:\r
             # only merge library classes and PCD for non-library module\r
             if self.IsLibrary:\r
                 self._DependentLibraryList = []\r
@@ -3683,7 +3683,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list                    The list of PCD\r
     #\r
     def _GetModulePcdList(self):\r
-        if self._ModulePcdList == None:\r
+        if self._ModulePcdList is None:\r
             # apply PCD settings from platform\r
             self._ModulePcdList = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)\r
             self.UpdateComments(self._PcdComments, self.Module.PcdComments)\r
@@ -3694,7 +3694,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list                    The list of PCD\r
     #\r
     def _GetLibraryPcdList(self):\r
-        if self._LibraryPcdList == None:\r
+        if self._LibraryPcdList is None:\r
             Pcds = sdict()\r
             if not self.IsLibrary:\r
                 # get PCDs from dependent libraries\r
@@ -3716,7 +3716,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     dict    The mapping between GUID cname and its value\r
     #\r
     def _GetGuidList(self):\r
-        if self._GuidList == None:\r
+        if self._GuidList is None:\r
             self._GuidList = sdict()\r
             self._GuidList.update(self.Module.Guids)\r
             for Library in self.DependentLibraryList:\r
@@ -3726,7 +3726,7 @@ class ModuleAutoGen(AutoGen):
         return self._GuidList\r
 \r
     def GetGuidsUsedByPcd(self):\r
-        if self._GuidsUsedByPcd == None:\r
+        if self._GuidsUsedByPcd is None:\r
             self._GuidsUsedByPcd = sdict()\r
             self._GuidsUsedByPcd.update(self.Module.GetGuidsUsedByPcd())\r
             for Library in self.DependentLibraryList:\r
@@ -3737,7 +3737,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     dict    The mapping between protocol cname and its value\r
     #\r
     def _GetProtocolList(self):\r
-        if self._ProtocolList == None:\r
+        if self._ProtocolList is None:\r
             self._ProtocolList = sdict()\r
             self._ProtocolList.update(self.Module.Protocols)\r
             for Library in self.DependentLibraryList:\r
@@ -3751,7 +3751,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     dict    The mapping between PPI cname and its value\r
     #\r
     def _GetPpiList(self):\r
-        if self._PpiList == None:\r
+        if self._PpiList is None:\r
             self._PpiList = sdict()\r
             self._PpiList.update(self.Module.Ppis)\r
             for Library in self.DependentLibraryList:\r
@@ -3765,7 +3765,7 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list                    The list path\r
     #\r
     def _GetIncludePathList(self):\r
-        if self._IncludePathList == None:\r
+        if self._IncludePathList is None:\r
             self._IncludePathList = []\r
             if self.AutoGenVersion < 0x00010005:\r
                 for Inc in self.Module.Includes:\r
@@ -3957,7 +3957,7 @@ class ModuleAutoGen(AutoGen):
             return\r
             \r
         # Skip the following code for modules with no source files\r
-        if self.SourceFileList == None or self.SourceFileList == []:\r
+        if self.SourceFileList is None or self.SourceFileList == []:\r
             return\r
 \r
         # Skip the following code for modules without any binary files\r
@@ -4172,7 +4172,7 @@ class ModuleAutoGen(AutoGen):
                         HexFormat = '0x%016x'\r
                     PcdValue = HexFormat % int(Pcd.DefaultValue, 0)\r
                 else:\r
-                    if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':\r
+                    if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':\r
                         EdkLogger.error("build", AUTOGEN_ERROR,\r
                                         "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName)\r
                                         )\r
@@ -4452,7 +4452,7 @@ class ModuleAutoGen(AutoGen):
 \r
     ## Summarize the ModuleAutoGen objects of all libraries used by this module\r
     def _GetLibraryAutoGenList(self):\r
-        if self._LibraryAutoGenList == None:\r
+        if self._LibraryAutoGenList is None:\r
             self._LibraryAutoGenList = []\r
             for Library in self.DependentLibraryList:\r
                 La = ModuleAutoGen(\r
@@ -4540,7 +4540,7 @@ class ModuleAutoGen(AutoGen):
         return True\r
 \r
     def GetTimeStampPath(self):\r
-        if self._TimeStampPath == None:\r
+        if self._TimeStampPath is None:\r
             self._TimeStampPath = os.path.join(self.MakeFileDir, 'AutoGenTimeStamp')\r
         return self._TimeStampPath\r
     def CreateTimeStamp(self, Makefile):\r
index 63ed47d94bcb402a618dd1b9fc48e93aeb30ad97..0daed7da610db1340c273205b671cb55a1166b95 100644 (file)
@@ -346,12 +346,12 @@ class BuildRule:
     def __init__(self, File=None, Content=None, LineIndex=0, SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]):\r
         self.RuleFile = File\r
         # Read build rules from file if it's not none\r
-        if File != None:\r
+        if File is not None:\r
             try:\r
                 self.RuleContent = open(File, 'r').readlines()\r
             except:\r
                 EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File)\r
-        elif Content != None:\r
+        elif Content is not None:\r
             self.RuleContent = Content\r
         else:\r
             EdkLogger.error("build", PARAMETER_MISSING, ExtraData="No rule file or string given")\r
@@ -478,7 +478,7 @@ class BuildRule:
                     EdkLogger.error("build", FORMAT_INVALID, "No file type given",\r
                                     File=self.RuleFile, Line=LineIndex + 1,\r
                                     ExtraData=self.RuleContent[LineIndex])\r
-                if self._FileTypePattern.match(FileType) == None:\r
+                if self._FileTypePattern.match(FileType) is None:\r
                     EdkLogger.error("build", FORMAT_INVALID, File=self.RuleFile, Line=LineIndex + 1,\r
                                     ExtraData="Only character, number (non-first character), '_' and '-' are allowed in file type")\r
             # new format: File-Type.Build-Type.Arch\r
@@ -561,7 +561,7 @@ class BuildRule:
         FileList = [File.strip() for File in self.RuleContent[LineIndex].split(",")]\r
         for ToolChainFamily in self._FamilyList:\r
             InputFiles = self._RuleInfo[ToolChainFamily, self._State]\r
-            if InputFiles == None:\r
+            if InputFiles is None:\r
                 InputFiles = []\r
                 self._RuleInfo[ToolChainFamily, self._State] = InputFiles\r
             InputFiles.extend(FileList)\r
@@ -573,7 +573,7 @@ class BuildRule:
     def ParseCommon(self, LineIndex):\r
         for ToolChainFamily in self._FamilyList:\r
             Items = self._RuleInfo[ToolChainFamily, self._State]\r
-            if Items == None:\r
+            if Items is None:\r
                 Items = []\r
                 self._RuleInfo[ToolChainFamily, self._State] = Items\r
             Items.append(self.RuleContent[LineIndex])\r
index 481c4dda1447d15a355b889beeebb35947ab4eca..cca6c8ab4fb57d77c2b157780e5888c46cf95124 100644 (file)
@@ -1085,7 +1085,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
                 if not Value.endswith('U'):\r
                     Value += 'U'\r
         if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:\r
-            if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':\r
+            if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':\r
                 EdkLogger.error("build", AUTOGEN_ERROR,\r
                                 "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName),\r
                                 ExtraData="[%s]" % str(Info))\r
@@ -1122,7 +1122,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 \r
         if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN', 'VOID*']:\r
             # handle structure PCD\r
-            if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':\r
+            if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':\r
                 EdkLogger.error("build", AUTOGEN_ERROR,\r
                                 "Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName),\r
                                 ExtraData="[%s]" % str(Info))\r
index 7aa22bd944a0037b0bca9f0a07385cd984829398..9acea8f6bfed17d02246f5179f07c1419acd52c1 100644 (file)
@@ -360,7 +360,7 @@ class DependencyExpression:
 \r
         FilePath = ""\r
         FileChangeFlag = True\r
-        if File == None:\r
+        if File is None:\r
             sys.stdout.write(Buffer.getvalue())\r
             FilePath = "STDOUT"\r
         else:\r
@@ -414,13 +414,13 @@ def Main():
         EdkLogger.SetLevel(EdkLogger.QUIET)\r
     elif Option.verbose:\r
         EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
-    elif Option.debug != None:\r
+    elif Option.debug is not None:\r
         EdkLogger.SetLevel(Option.debug + 1)\r
     else:\r
         EdkLogger.SetLevel(EdkLogger.INFO)\r
 \r
     try:\r
-        if Option.ModuleType == None or Option.ModuleType not in gType2Phase:\r
+        if Option.ModuleType is None or Option.ModuleType not in gType2Phase:\r
             EdkLogger.error("GenDepex", OPTION_MISSING, "Module type is not specified or supported")\r
 \r
         DxsFile = ''\r
@@ -437,7 +437,7 @@ def Main():
             EdkLogger.error("GenDepex", OPTION_MISSING, "No expression string or file given")\r
 \r
         Dpx = DependencyExpression(DxsString, Option.ModuleType, Option.Optimize)\r
-        if Option.OutputFile != None:\r
+        if Option.OutputFile is not None:\r
             FileChangeFlag = Dpx.Generate(Option.OutputFile)\r
             if not FileChangeFlag and DxsFile:\r
                 #\r
@@ -450,7 +450,7 @@ def Main():
             Dpx.Generate()\r
     except BaseException, X:\r
         EdkLogger.quiet("")\r
-        if Option != None and Option.debug != None:\r
+        if Option is not None and Option.debug is not None:\r
             EdkLogger.quiet(traceback.format_exc())\r
         else:\r
             EdkLogger.quiet(str(X))\r
index 60bd625cd2b1f7d88b2722b52cb05b51c8d70374..dcdfcca1a5b066e453752781268083a99265c3d2 100644 (file)
@@ -906,12 +906,12 @@ cleanlib:
             # skip non-C files\r
             if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":\r
                 continue\r
-            elif DepSet == None:\r
+            elif DepSet is None:\r
                 DepSet = set(self.FileDependency[File])\r
             else:\r
                 DepSet &= set(self.FileDependency[File])\r
         # in case nothing in SourceFileList\r
-        if DepSet == None:\r
+        if DepSet is None:\r
             DepSet = set()\r
         #\r
         # Extract common files list in the dependency files\r
@@ -1516,7 +1516,7 @@ class TopLevelMakefile(BuildFile):
 \r
         # TRICK: for not generating GenFds call in makefile if no FDF file\r
         MacroList = []\r
-        if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":\r
+        if PlatformInfo.FdfFile is not None and PlatformInfo.FdfFile != "":\r
             FdfFileList = [PlatformInfo.FdfFile]\r
             # macros passed to GenFds\r
             MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))\r
index e4d7f3b759a9e7761a305578f20a3ebff608f539..a2c4fb39ec85b13000ff30757e992ea52370bbdb 100644 (file)
@@ -1234,7 +1234,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
         for SkuName in Pcd.SkuInfoList:\r
             Sku = Pcd.SkuInfoList[SkuName]\r
             SkuId = Sku.SkuId\r
-            if SkuId == None or SkuId == '':\r
+            if SkuId is None or SkuId == '':\r
                 continue\r
 \r
                 \r
index d6d4703370aa79507426afffca5bb2c554ef1070..cb72219b40d5b19f7f01784726730bde99f327c9 100644 (file)
@@ -76,7 +76,7 @@ class IdfFileClassObject(object):
                 self.LoadIdfFile(File)\r
 \r
     def LoadIdfFile(self, File = None):\r
-        if File == None:\r
+        if File is None:\r
             EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'No Image definition file is given.')\r
         self.File = File\r
 \r
@@ -106,7 +106,7 @@ class IdfFileClassObject(object):
                 if Len == 4 and LineDetails[2] != 'TRANSPARENT':\r
                     EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'Please use the keyword "TRANSPARENT" to describe the transparency setting in Line %s of File %s.' % (LineNo, File.Path))\r
                 MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', LineDetails[1], re.UNICODE)\r
-                if MatchString == None or MatchString.end(0) != len(LineDetails[1]):\r
+                if MatchString is None or MatchString.end(0) != len(LineDetails[1]):\r
                     EdkLogger.error('Image Definition  File Parser', FORMAT_INVALID, 'The Image token name %s defined in Idf file %s contains the invalid character.' % (LineDetails[1], File.Path))\r
                 if LineDetails[1] not in self.ImageIDList:\r
                     self.ImageIDList.append(LineDetails[1])\r
index 9c7dd1e40374adf45080909a6f0b34f807c8a884..73af1214eb0acf7e6a5938d226a3c07a3de94dd3 100644 (file)
@@ -150,7 +150,7 @@ def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
         Name = StringItem.StringName\r
         Token = StringItem.Token\r
         Referenced = StringItem.Referenced\r
-        if Name != None:\r
+        if Name is not None:\r
             Line = ''\r
             if Referenced == True:\r
                 if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:\r
@@ -478,11 +478,11 @@ def CreateCFile(BaseName, UniObjectClass, IsCompatibleMode, FilterInfo):
 # @retval FileList:    A list of all files found\r
 #\r
 def GetFileList(SourceFileList, IncludeList, SkipList):\r
-    if IncludeList == None:\r
+    if IncludeList is None:\r
         EdkLogger.error("UnicodeStringGather", AUTOGEN_ERROR, "Include path for unicode file is not defined")\r
 \r
     FileList = []\r
-    if SkipList == None:\r
+    if SkipList is None:\r
         SkipList = []\r
 \r
     for File in SourceFileList:\r
index 5b674dfbc2f0a04cf6ee3728b072b04efa97f5d0..242402dfaeeb511f7bbf4420cbd7feafc8fe4d6f 100644 (file)
@@ -124,7 +124,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
     if IsCompatibleMode:\r
         if length == 3 and LangName.isalpha():\r
             TempLangName = LangConvTable.get(LangName.lower())\r
-            if TempLangName != None:\r
+            if TempLangName is not None:\r
                 return TempLangName\r
             return LangName\r
         else:\r
@@ -136,7 +136,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
         if LangName.isalpha():\r
             return LangName\r
     elif length == 3:\r
-        if LangName.isalpha() and LangConvTable.get(LangName.lower()) == None:\r
+        if LangName.isalpha() and LangConvTable.get(LangName.lower()) is None:\r
             return LangName\r
     elif length == 5:\r
         if LangName[0:2].isalpha() and LangName[2] == '-':\r
@@ -144,7 +144,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
     elif length >= 6:\r
         if LangName[0:2].isalpha() and LangName[2] == '-':\r
             return LangName\r
-        if LangName[0:3].isalpha() and LangConvTable.get(LangName.lower()) == None and LangName[3] == '-':\r
+        if LangName[0:3].isalpha() and LangConvTable.get(LangName.lower()) is None and LangName[3] == '-':\r
             return LangName\r
 \r
     EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid RFC 4646 language code : %s" % LangName, File)\r
@@ -195,14 +195,14 @@ class StringDefClassObject(object):
         self.UseOtherLangDef = UseOtherLangDef\r
         self.Length = 0\r
 \r
-        if Name != None:\r
+        if Name is not None:\r
             self.StringName = Name\r
             self.StringNameByteList = UniToHexList(Name)\r
-        if Value != None:\r
+        if Value is not None:\r
             self.StringValue = Value + u'\x00'        # Add a NULL at string tail\r
             self.StringValueByteList = UniToHexList(self.StringValue)\r
             self.Length = len(self.StringValueByteList)\r
-        if Token != None:\r
+        if Token is not None:\r
             self.Token = Token\r
 \r
     def __str__(self):\r
@@ -213,7 +213,7 @@ class StringDefClassObject(object):
                repr(self.UseOtherLangDef)\r
 \r
     def UpdateValue(self, Value = None):\r
-        if Value != None:\r
+        if Value is not None:\r
             self.StringValue = Value + u'\x00'        # Add a NULL at string tail\r
             self.StringValueByteList = UniToHexList(self.StringValue)\r
             self.Length = len(self.StringValueByteList)\r
@@ -352,7 +352,7 @@ class UniFileClassObject(object):
         # Check the string name\r
         if Name != '':\r
             MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE)\r
-            if MatchString == None or MatchString.end(0) != len(Name):\r
+            if MatchString is None or MatchString.end(0) != len(Name):\r
                 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
         LanguageList = Item.split(u'#language ')\r
         for IndexI in range(len(LanguageList)):\r
@@ -466,7 +466,7 @@ class UniFileClassObject(object):
     # Load a .uni file\r
     #\r
     def LoadUniFile(self, File = None):\r
-        if File == None:\r
+        if File is None:\r
             EdkLogger.error("Unicode File Parser", PARSER_ERROR, 'No unicode file is given')\r
         self.File = File\r
         #\r
@@ -522,7 +522,7 @@ class UniFileClassObject(object):
                 # Check the string name\r
                 if not self.IsCompatibleMode and Name != '':\r
                     MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE)\r
-                    if MatchString == None or MatchString.end(0) != len(Name):\r
+                    if MatchString is None or MatchString.end(0) != len(Name):\r
                         EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
                 self.AddStringToList(Name, Language, Value)\r
                 continue\r
@@ -578,7 +578,7 @@ class UniFileClassObject(object):
         IsAdded = True\r
         if Name in self.OrderedStringDict[Language]:\r
             IsAdded = False\r
-            if Value != None:\r
+            if Value is not None:\r
                 ItemIndexInList = self.OrderedStringDict[Language][Name]\r
                 Item = self.OrderedStringList[Language][ItemIndexInList]\r
                 Item.UpdateValue(Value)\r
index b1e328ff3f118096f83091e7ca51a0ee528aa505..6c8f89f5d12bb6502c41ae156e6acf1cc8a16a0d 100644 (file)
@@ -57,21 +57,21 @@ def main():
         EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
     elif Options.opt_quiet:\r
         EdkLogger.SetLevel(EdkLogger.QUIET)\r
-    elif Options.debug_level != None:\r
+    elif Options.debug_level is not None:\r
         EdkLogger.SetLevel(Options.debug_level + 1) \r
     else:\r
         EdkLogger.SetLevel(EdkLogger.INFO)\r
                   \r
-    if Options.bin_filename == None:\r
+    if Options.bin_filename is None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -o option to specify the file name for the VPD binary file")  \r
-    if Options.filename == None:\r
+    if Options.filename is None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -m option to specify the file name for the mapping file")  \r
 \r
     Force = False\r
-    if Options.opt_force != None:\r
+    if Options.opt_force is not None:\r
         Force = True\r
 \r
-    if (Args[0] != None) :\r
+    if (Args[0] is not None) :\r
         StartBpdg(Args[0], Options.filename, Options.bin_filename, Force)\r
     else :\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please specify the file which contain the VPD pcd info.",\r
index cdfc420c66f73fbb5d2f64ff409e58432832c102..887240e94cb4147bd25bafe0d1e1a3977f9f13b0 100644 (file)
@@ -381,7 +381,7 @@ class GenVPD :
         # Delete useless lines\r
         while (True) :\r
             try :\r
-                if (self.FileLinesList[count] == None) :\r
+                if (self.FileLinesList[count] is None) :\r
                     del(self.FileLinesList[count])\r
                 else :\r
                     count += 1\r
@@ -398,7 +398,7 @@ class GenVPD :
         # Process the pcds one by one base on the pcd's value and size\r
         count = 0\r
         for line in self.FileLinesList:\r
-            if line != None :\r
+            if line is not None :\r
                 PCD = PcdEntry(line[0], line[1], line[2], line[3], line[4],line[5], self.InputFileName)   \r
                 # Strip the space char\r
                 PCD.PcdCName     = PCD.PcdCName.strip(' ')\r
index d7c70a7336a01f8a3d97894ccc1b066880a54583..835dbd5935d2e207a7e419390eaaa905f2c9fa1b 100644 (file)
@@ -116,7 +116,7 @@ class Dec(DecObject):
         #\r
         # Load Dec file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadDecFile(Filename)\r
 \r
         #\r
index 1c33fefabf986d86db96e95c9cf252d45ec4a026..f653275ff13f8fde47c9a96917ae33eda943ff2e 100644 (file)
@@ -54,7 +54,7 @@ def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplit
 # @param Dict:  The dictionary to be printed\r
 #\r
 def printDict(Dict):\r
-    if Dict != None:\r
+    if Dict is not None:\r
         KeyList = Dict.keys()\r
         for Key in KeyList:\r
             if Dict[Key] != '':\r
index c2fa1c275a2d99a774e28a432307f602d114df96..b98dbf57229b9480978a20ca6a0ad92eb8af6440 100644 (file)
@@ -128,7 +128,7 @@ class Dsc(DscObject):
         #\r
         # Load Dsc file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadDscFile(Filename)\r
 \r
         #\r
@@ -902,7 +902,7 @@ class Dsc(DscObject):
     #\r
     def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName='', VariableGuid='', VariableOffset='', HiiDefaultValue='', VpdOffset='', DefaultValue=''):\r
         SkuNameList = GetSplitValueList(SkuNameList)\r
-        if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:\r
+        if SkuNameList is None or SkuNameList == [] or SkuNameList == ['']:\r
             SkuNameList = ['DEFAULT']\r
         SkuInfoList = {}\r
         for Item in SkuNameList:\r
index f22a545b77ce94fec23ae2c110fef5b333a3cec4..c14b4eb52d50f32a9c3e3fbac94de958327b4174 100644 (file)
@@ -38,7 +38,7 @@ class EdkIIWorkspace:
         #\r
         # Check environment valiable 'WORKSPACE'\r
         #\r
-        if os.environ.get('WORKSPACE') == None:\r
+        if os.environ.get('WORKSPACE') is None:\r
             print 'ERROR: WORKSPACE not defined.    Please run EdkSetup from the EDK II install directory.'\r
             return False\r
 \r
index d6df01d4ce0654e8a671c4f1f3a041bfae044e4c..c0966d5265190e748d90248f86d8b367d2284a0c 100644 (file)
@@ -93,7 +93,7 @@ class PcdClassObject(object):
     # @retval True  The two pcds are the same\r
     #\r
     def __eq__(self, Other):\r
-        return Other != None and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName\r
+        return Other is not None and self.TokenCName == Other.TokenCName and self.TokenSpaceGuidCName == Other.TokenSpaceGuidCName\r
 \r
     ## Override __hash__ function\r
     #\r
@@ -121,7 +121,7 @@ class LibraryClassObject(object):
     def __init__(self, Name = None, SupModList = [], Type = None):\r
         self.LibraryClass = Name\r
         self.SupModList = SupModList\r
-        if Type != None:\r
+        if Type is not None:\r
             self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT)\r
 \r
 ## ModuleBuildClassObject\r
@@ -864,7 +864,7 @@ class WorkspaceBuild(object):
                             for Libs in Pb.LibraryClass:\r
                                 for Type in Libs.SupModList:\r
                                     Instance = self.FindLibraryClassInstanceOfLibrary(Lib, Arch, Type)\r
-                                    if Instance == None:\r
+                                    if Instance is None:\r
                                         Instance = RecommendedInstance\r
                                     Pb.LibraryClasses[(Lib, Type)] = Instance\r
                         else:\r
@@ -872,7 +872,7 @@ class WorkspaceBuild(object):
                             # For Module\r
                             #\r
                             Instance = self.FindLibraryClassInstanceOfModule(Lib, Arch, Pb.ModuleType, Inf)\r
-                            if Instance == None:\r
+                            if Instance is None:\r
                                 Instance = RecommendedInstance\r
                             Pb.LibraryClasses[(Lib, Pb.ModuleType)] = Instance\r
 \r
@@ -912,7 +912,7 @@ class WorkspaceBuild(object):
                     if not self.IsModuleDefinedInPlatform(Inf, Arch, InfList):\r
                         continue\r
                     Module = self.Build[Arch].ModuleDatabase[Inf]\r
-                    if Module.LibraryClass == None or Module.LibraryClass == []:\r
+                    if Module.LibraryClass is None or Module.LibraryClass == []:\r
                         self.UpdateLibrariesOfModule(Platform, Module, Arch)\r
                         for Key in Module.LibraryClasses:\r
                             Lib = Module.LibraryClasses[Key]\r
@@ -969,15 +969,15 @@ class WorkspaceBuild(object):
                     continue\r
 \r
                 LibraryClassName = Key[0]\r
-                if LibraryClassName not in LibraryInstance or LibraryInstance[LibraryClassName] == None:\r
-                    if LibraryPath == None or LibraryPath == "":\r
+                if LibraryClassName not in LibraryInstance or LibraryInstance[LibraryClassName] is None:\r
+                    if LibraryPath is None or LibraryPath == "":\r
                         LibraryInstance[LibraryClassName] = None\r
                         continue\r
                     LibraryModule = ModuleDatabase[LibraryPath]\r
                     LibraryInstance[LibraryClassName] = LibraryModule\r
                     LibraryConsumerList.append(LibraryModule)\r
                     EdkLogger.verbose("\t" + LibraryClassName + " : " + str(LibraryModule))\r
-                elif LibraryPath == None or LibraryPath == "":\r
+                elif LibraryPath is None or LibraryPath == "":\r
                     continue\r
                 else:\r
                     LibraryModule = LibraryInstance[LibraryClassName]\r
@@ -1002,7 +1002,7 @@ class WorkspaceBuild(object):
         Q = []\r
         for LibraryClassName in LibraryInstance:\r
             M = LibraryInstance[LibraryClassName]\r
-            if M == None:\r
+            if M is None:\r
                 EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
                                 "Library instance for library class [%s] is not found" % LibraryClassName,\r
                                 ExtraData="\t%s [%s]" % (str(Module), Arch))\r
@@ -1011,7 +1011,7 @@ class WorkspaceBuild(object):
             # check if there're duplicate library classes\r
             #\r
             for Lc in M.LibraryClass:\r
-                if Lc.SupModList != None and ModuleType not in Lc.SupModList:\r
+                if Lc.SupModList is not None and ModuleType not in Lc.SupModList:\r
                     EdkLogger.error("AutoGen", AUTOGEN_ERROR,\r
                                     "Module type [%s] is not supported by library instance [%s]" % (ModuleType, str(M)),\r
                                     ExtraData="\t%s" % str(Module))\r
@@ -1380,7 +1380,7 @@ class WorkspaceBuild(object):
             if (Name, Guid) in Pcds:\r
                 OwnerPlatform = Dsc\r
                 Pcd = Pcds[(Name, Guid)]\r
-                if Pcd.Type != '' and Pcd.Type != None:\r
+                if Pcd.Type != '' and Pcd.Type is not None:\r
                     NewType = Pcd.Type\r
                     if NewType in DataType.PCD_DYNAMIC_TYPE_LIST:\r
                         NewType = DataType.TAB_PCDS_DYNAMIC\r
@@ -1396,13 +1396,13 @@ class WorkspaceBuild(object):
                     EdkLogger.error("AutoGen", PARSER_ERROR, ErrorMsg)\r
 \r
 \r
-                if Pcd.DatumType != '' and Pcd.DatumType != None:\r
+                if Pcd.DatumType != '' and Pcd.DatumType is not None:\r
                     DatumType = Pcd.DatumType\r
-                if Pcd.TokenValue != '' and Pcd.TokenValue != None:\r
+                if Pcd.TokenValue != '' and Pcd.TokenValue is not None:\r
                     Token = Pcd.TokenValue\r
-                if Pcd.DefaultValue != '' and Pcd.DefaultValue != None:\r
+                if Pcd.DefaultValue != '' and Pcd.DefaultValue is not None:\r
                     Value = Pcd.DefaultValue\r
-                if Pcd.MaxDatumSize != '' and Pcd.MaxDatumSize != None:\r
+                if Pcd.MaxDatumSize != '' and Pcd.MaxDatumSize is not None:\r
                     MaxDatumSize = Pcd.MaxDatumSize\r
                 SkuInfoList =  Pcd.SkuInfoList\r
                 \r
index ac1c8edc4fe2fd8332d78ff48808020e66d63147..3f462df49ada100eefa586161cd54f3d836c9773 100644 (file)
@@ -89,7 +89,7 @@ def debug(Level, Message, ExtraData=None):
         "msg"       : Message,\r
     }\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText = _DebugMessageTemplate % TemplateDict + "\n    %s" % ExtraData\r
     else:\r
         LogText = _DebugMessageTemplate % TemplateDict\r
@@ -119,10 +119,10 @@ def warn(ToolName, Message, File=None, Line=None, ExtraData=None):
         return\r
 \r
     # if no tool name given, use caller's source file name as tool name\r
-    if ToolName == None or ToolName == "":\r
+    if ToolName is None or ToolName == "":\r
         ToolName = os.path.basename(traceback.extract_stack()[-2][0])\r
 \r
-    if Line == None:\r
+    if Line is None:\r
         Line = "..."\r
     else:\r
         Line = "%d" % Line\r
@@ -134,12 +134,12 @@ def warn(ToolName, Message, File=None, Line=None, ExtraData=None):
         "msg"       : Message,\r
     }\r
 \r
-    if File != None:\r
+    if File is not None:\r
         LogText = _WarningMessageTemplate % TemplateDict\r
     else:\r
         LogText = _WarningMessageTemplateWithoutFile % TemplateDict\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText += "\n    %s" % ExtraData\r
 \r
     _InfoLogger.log(WARN, LogText)\r
@@ -168,18 +168,18 @@ info    = _InfoLogger.info
 #                       it's True. This is the default behavior.\r
 #\r
 def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=None, RaiseError=IsRaiseError):\r
-    if Line == None:\r
+    if Line is None:\r
         Line = "..."\r
     else:\r
         Line = "%d" % Line\r
 \r
-    if Message == None:\r
+    if Message is None:\r
         if ErrorCode in gErrorMessage:\r
             Message = gErrorMessage[ErrorCode]\r
         else:\r
             Message = gErrorMessage[UNKNOWN_ERROR]\r
 \r
-    if ExtraData == None:\r
+    if ExtraData is None:\r
         ExtraData = ""\r
 \r
     TemplateDict = {\r
@@ -191,7 +191,7 @@ def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=Non
         "extra"     : ExtraData\r
     }\r
 \r
-    if File != None:\r
+    if File is not None:\r
         LogText =  _ErrorMessageTemplate % TemplateDict\r
     else:\r
         LogText = _ErrorMessageTemplateWithoutFile % TemplateDict\r
index 3e7d44954c885e264dd9c9c8ad97cf4e61618533..3d37800d9ab78905ead4f5d166dfbfe1fa904634 100644 (file)
@@ -51,7 +51,7 @@ class Fdf(FdfObject):
         #\r
         # Load Fdf file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadFdfFile(Filename)\r
 \r
     #\r
index b7b5e21a9e3f4c703b784066ed69ba9f6a835358..66815d3e17fe53125ab93b5e418ec425ac1a33b5 100644 (file)
@@ -356,7 +356,7 @@ class FdfParser(object):
                         if Profile.FileName == File and Profile.MacroName == Name and Profile.DefinedAtLine <= Line:\r
                             Value = Profile.MacroValue\r
                             \r
-                if Value != None:\r
+                if Value is not None:\r
                     Str = Str.replace('$(' + Name + ')', Value)\r
                     MacroEnd = MacroStart + len(Value) \r
                 \r
@@ -679,8 +679,8 @@ class FdfParser(object):
         FileLineTuple = GetRealFileLine(self.FileName, Line)\r
         if Name in InputMacroDict:\r
             MacroValue = InputMacroDict[Name]\r
-            if Op == None:\r
-                if Value == 'Bool' and MacroValue == None or MacroValue.upper() == 'FALSE':\r
+            if Op is None:\r
+                if Value == 'Bool' and MacroValue is None or MacroValue.upper() == 'FALSE':\r
                     return False\r
                 return True\r
             elif Op == '!=':\r
@@ -694,7 +694,7 @@ class FdfParser(object):
                 else:\r
                     return False\r
             else:\r
-                if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(MacroValue) or (MacroValue != None and MacroValue.isdigit())):\r
+                if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(MacroValue) or (MacroValue is not None and MacroValue.isdigit())):\r
                     InputVal = long(Value, 0)\r
                     MacroVal = long(MacroValue, 0)\r
                     if Op == '>':\r
@@ -724,8 +724,8 @@ class FdfParser(object):
                 \r
         for Profile in AllMacroList:\r
             if Profile.FileName == FileLineTuple[0] and Profile.MacroName == Name and Profile.DefinedAtLine <= FileLineTuple[1]:\r
-                if Op == None:\r
-                    if Value == 'Bool' and Profile.MacroValue == None or Profile.MacroValue.upper() == 'FALSE':\r
+                if Op is None:\r
+                    if Value == 'Bool' and Profile.MacroValue is None or Profile.MacroValue.upper() == 'FALSE':\r
                         return False\r
                     return True\r
                 elif Op == '!=':\r
@@ -739,7 +739,7 @@ class FdfParser(object):
                     else:\r
                         return False\r
                 else:\r
-                    if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(Profile.MacroValue) or (Profile.MacroValue != None and Profile.MacroValue.isdigit())):\r
+                    if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(Profile.MacroValue) or (Profile.MacroValue is not None and Profile.MacroValue.isdigit())):\r
                         InputVal = long(Value, 0)\r
                         MacroVal = long(Profile.MacroValue, 0)\r
                         if Op == '>':\r
@@ -935,7 +935,7 @@ class FdfParser(object):
         \r
         if not self.__GetNextToken():\r
             return False\r
-        if gGuidPattern.match(self.__Token) != None:\r
+        if gGuidPattern.match(self.__Token) is not None:\r
             return True\r
         else:\r
             self.__UndoToken()\r
@@ -1454,7 +1454,7 @@ class FdfParser(object):
             pass\r
         \r
         for Item in Obj.BlockSizeList:\r
-            if Item[0] == None or Item[1] == None:\r
+            if Item[0] is None or Item[1] is None:\r
                 raise Warning("expected block statement for Fd Section", self.FileName, self.CurrentLineNumber)\r
 \r
         return True\r
@@ -2423,7 +2423,7 @@ class FdfParser(object):
             \r
             FvImageSectionObj = CommonDataClass.FdfClass.FvImageSectionClassObject()\r
             FvImageSectionObj.Alignment = AlignValue\r
-            if FvObj != None:\r
+            if FvObj is not None:\r
                 FvImageSectionObj.Fv = FvObj\r
                 FvImageSectionObj.FvName = None\r
             else:\r
@@ -2942,7 +2942,7 @@ class FdfParser(object):
             Rule.CheckSum = CheckSum\r
             Rule.Fixed = Fixed\r
             Rule.KeyStringList = KeyStringList\r
-            if KeepReloc != None:\r
+            if KeepReloc is not None:\r
                 Rule.KeepReloc = KeepReloc\r
             \r
             while True:\r
@@ -2969,7 +2969,7 @@ class FdfParser(object):
             Rule.Fixed = Fixed\r
             Rule.FileExtension = Ext\r
             Rule.KeyStringList = KeyStringList\r
-            if KeepReloc != None:\r
+            if KeepReloc is not None:\r
                 Rule.KeepReloc = KeepReloc\r
             \r
             return Rule\r
@@ -3012,7 +3012,7 @@ class FdfParser(object):
             Rule.Fixed = Fixed\r
             Rule.FileName = self.__Token\r
             Rule.KeyStringList = KeyStringList\r
-            if KeepReloc != None:\r
+            if KeepReloc is not None:\r
                 Rule.KeepReloc = KeepReloc\r
             return Rule\r
         \r
@@ -3149,7 +3149,7 @@ class FdfParser(object):
                     EfiSectionObj.KeepReloc = False\r
                 else:\r
                     EfiSectionObj.KeepReloc = True\r
-                if Obj.KeepReloc != None and Obj.KeepReloc != EfiSectionObj.KeepReloc:\r
+                if Obj.KeepReloc is not None and Obj.KeepReloc != EfiSectionObj.KeepReloc:\r
                     raise Warning("Section type %s has reloc strip flag conflict with Rule At Line %d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)\r
             else:\r
                 raise Warning("Section type %s could not have reloc strip flag At Line %d" % (EfiSectionObj.SectionType, self.CurrentLineNumber), self.FileName, self.CurrentLineNumber)\r
@@ -3471,7 +3471,7 @@ class FdfParser(object):
             raise Warning("expected Component version At Line ", self.FileName, self.CurrentLineNumber)\r
 \r
         Pattern = re.compile('-$|[0-9]{0,1}[0-9]{1}\.[0-9]{0,1}[0-9]{1}')\r
-        if Pattern.match(self.__Token) == None:\r
+        if Pattern.match(self.__Token) is None:\r
             raise Warning("Unknown version format At line ", self.FileName, self.CurrentLineNumber)\r
         CompStatementObj.CompVer = self.__Token\r
         \r
@@ -3544,7 +3544,7 @@ class FdfParser(object):
             for elementRegion in FdObj.RegionList:\r
                 if elementRegion.RegionType == 'FV':\r
                     for elementRegionData in elementRegion.RegionDataList:\r
-                        if elementRegionData != None and elementRegionData.upper() not in FvList:\r
+                        if elementRegionData is not None and elementRegionData.upper() not in FvList:\r
                             FvList.append(elementRegionData.upper())\r
         return FvList\r
     \r
@@ -3561,9 +3561,9 @@ class FdfParser(object):
         \r
         for FfsObj in FvObj.FfsList:\r
             if isinstance(FfsObj, FfsFileStatement.FileStatement):\r
-                if FfsObj.FvName != None and FfsObj.FvName.upper() not in RefFvList:\r
+                if FfsObj.FvName is not None and FfsObj.FvName.upper() not in RefFvList:\r
                     RefFvList.append(FfsObj.FvName.upper())\r
-                elif FfsObj.FdName != None and FfsObj.FdName.upper() not in RefFdList:\r
+                elif FfsObj.FdName is not None and FfsObj.FdName.upper() not in RefFdList:\r
                     RefFdList.append(FfsObj.FdName.upper())\r
                 else:\r
                     self.__GetReferencedFdFvTupleFromSection(FfsObj, RefFdList, RefFvList)    \r
@@ -3584,9 +3584,9 @@ class FdfParser(object):
         while SectionStack != []:\r
             SectionObj = SectionStack.pop()\r
             if isinstance(SectionObj, FvImageSection.FvImageSection):\r
-                if SectionObj.FvName != None and SectionObj.FvName.upper() not in FvList:\r
+                if SectionObj.FvName is not None and SectionObj.FvName.upper() not in FvList:\r
                     FvList.append(SectionObj.FvName.upper())\r
-                if SectionObj.Fv != None and SectionObj.Fv.UiFvName != None and SectionObj.Fv.UiFvName.upper() not in FvList:\r
+                if SectionObj.Fv is not None and SectionObj.Fv.UiFvName is not None and SectionObj.Fv.UiFvName.upper() not in FvList:\r
                     FvList.append(SectionObj.Fv.UiFvName.upper())\r
                     self.__GetReferencedFdFvTuple(SectionObj.Fv, FdList, FvList)\r
             \r
index f24e4e41a0c1e36e5679cd54c9218a588a64a933..ba43eb5484714978cb99faa01ec6d75a32bce6e9 100644 (file)
@@ -199,7 +199,7 @@ class Inf(InfObject):
         #\r
         # Load Inf file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadInfFile(Filename)\r
 \r
         #\r
index 8f479ace4cb15fadfbee9da6f65e4b353c3277ba..4c33e645fadaf7c02d88989bf55d63aa837e29d3 100644 (file)
@@ -85,7 +85,7 @@ def _parseForXcode(lines, efifilepath, varnames):
             for varname in varnames:\r
                 if varname in line:\r
                     m = re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$' % varname, line)\r
-                    if m != None:\r
+                    if m is not None:\r
                         ret.append((varname, m.group(1)))\r
     return ret\r
 \r
@@ -110,27 +110,27 @@ def _parseForGCC(lines, efifilepath, varnames):
         # status handler\r
         if status == 3:\r
             m = re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$', line)\r
-            if m != None:\r
+            if m is not None:\r
                 sections.append(m.groups(0))\r
             for varname in varnames:\r
                 Str = ''\r
                 m = re.match("^.data.(%s)" % varname, line)\r
-                if m != None:\r
+                if m is not None:\r
                     m = re.match(".data.(%s)$" % varname, line)\r
-                    if m != None:\r
+                    if m is not None:\r
                         Str = lines[index + 1]\r
                     else:\r
                         Str = line[len(".data.%s" % varname):]\r
                     if Str:\r
                         m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', Str.strip())\r
-                        if m != None:\r
+                        if m is not None:\r
                             varoffset.append((varname, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))\r
 \r
     if not varoffset:\r
         return []\r
     # get section information from efi file\r
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r
-    if efisecs == None or len(efisecs) == 0:\r
+    if efisecs is None or len(efisecs) == 0:\r
         return []\r
     #redirection\r
     redirection = 0\r
@@ -166,19 +166,19 @@ def _parseGeneral(lines, efifilepath, varnames):
             continue        \r
         if status == 1 and len(line) != 0:\r
             m =  secRe.match(line)\r
-            assert m != None, "Fail to parse the section in map file , line is %s" % line\r
+            assert m is not None, "Fail to parse the section in map file , line is %s" % line\r
             sec_no, sec_start, sec_length, sec_name, sec_class = m.groups(0)\r
             secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_length, 16), sec_name, sec_class])\r
         if status == 2 and len(line) != 0:\r
             for varname in varnames:\r
                 m = symRe.match(line)\r
-                assert m != None, "Fail to parse the symbol in map file, line is %s" % line\r
+                assert m is not None, "Fail to parse the symbol in map file, line is %s" % line\r
                 sec_no, sym_offset, sym_name, vir_addr = m.groups(0)\r
                 sec_no     = int(sec_no,     16)\r
                 sym_offset = int(sym_offset, 16)\r
                 vir_addr   = int(vir_addr,   16)\r
                 m2 = re.match('^[_]*(%s)' % varname, sym_name)\r
-                if m2 != None:\r
+                if m2 is not None:\r
                     # fond a binary pcd entry in map file\r
                     for sec in secs:\r
                         if sec[0] == sec_no and (sym_offset >= sec[1] and sym_offset < sec[1] + sec[2]):\r
@@ -188,7 +188,7 @@ def _parseGeneral(lines, efifilepath, varnames):
 \r
     # get section information from efi file\r
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r
-    if efisecs == None or len(efisecs) == 0:\r
+    if efisecs is None or len(efisecs) == 0:\r
         return []\r
 \r
     ret = []\r
@@ -423,7 +423,7 @@ def GuidStructureStringToGuidValueName(GuidValue):
 #   @param      Directory   The directory name\r
 #\r
 def CreateDirectory(Directory):\r
-    if Directory == None or Directory.strip() == "":\r
+    if Directory is None or Directory.strip() == "":\r
         return True\r
     try:\r
         if not os.access(Directory, os.F_OK):\r
@@ -437,7 +437,7 @@ def CreateDirectory(Directory):
 #   @param      Directory   The directory name\r
 #\r
 def RemoveDirectory(Directory, Recursively=False):\r
-    if Directory == None or Directory.strip() == "" or not os.path.exists(Directory):\r
+    if Directory is None or Directory.strip() == "" or not os.path.exists(Directory):\r
         return\r
     if Recursively:\r
         CurrentDirectory = os.getcwd()\r
@@ -540,7 +540,7 @@ def DataDump(Data, File):
     except:\r
         EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)\r
     finally:\r
-        if Fd != None:\r
+        if Fd is not None:\r
             Fd.close()\r
 \r
 ## Restore a Python object from a file\r
@@ -560,7 +560,7 @@ def DataRestore(File):
         EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))\r
         Data = None\r
     finally:\r
-        if Fd != None:\r
+        if Fd is not None:\r
             Fd.close()\r
     return Data\r
 \r
@@ -668,7 +668,7 @@ def GetFiles(Root, SkipList=None, FullPath=True):
 #   @retval     False   if file doesn't exists\r
 #\r
 def ValidFile(File, Ext=None):\r
-    if Ext != None:\r
+    if Ext is not None:\r
         Dummy, FileExt = os.path.splitext(File)\r
         if FileExt.lower() != Ext.lower():\r
             return False\r
@@ -715,13 +715,13 @@ def RealPath2(File, Dir='', OverrideDir=''):
 #\r
 def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''):\r
     NewFile = File\r
-    if Ext != None:\r
+    if Ext is not None:\r
         Dummy, FileExt = os.path.splitext(File)\r
         if FileExt.lower() != Ext.lower():\r
             return False, File\r
 \r
     # Replace the Edk macros\r
-    if OverrideDir != '' and OverrideDir != None:\r
+    if OverrideDir != '' and OverrideDir is not None:\r
         if OverrideDir.find('$(EFI_SOURCE)') > -1:\r
             OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource)\r
         if OverrideDir.find('$(EDK_SOURCE)') > -1:\r
@@ -737,19 +737,19 @@ def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='
         NewFile = File.replace('$(EFI_SOURCE)', EfiSource)\r
         NewFile = NewFile.replace('$(EDK_SOURCE)', EdkSource)\r
         NewFile = AllFiles[os.path.normpath(NewFile)]\r
-        if NewFile != None:\r
+        if NewFile is not None:\r
             return True, NewFile\r
 \r
     # Second check the path with override value\r
-    if OverrideDir != '' and OverrideDir != None:\r
+    if OverrideDir != '' and OverrideDir is not None:\r
         NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))]\r
-        if NewFile != None:\r
+        if NewFile is not None:\r
             return True, NewFile\r
 \r
     # Last check the path with normal definitions\r
     File = os.path.join(Dir, File)\r
     NewFile = AllFiles[os.path.normpath(File)]\r
-    if NewFile != None:\r
+    if NewFile is not None:\r
         return True, NewFile\r
 \r
     return False, File\r
@@ -759,7 +759,7 @@ def ValidFile2(AllFiles, File, Ext=None, Workspace='', EfiSource='', EdkSource='
 #\r
 def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.', OverrideDir=''):\r
     # Replace the Edk macros\r
-    if OverrideDir != '' and OverrideDir != None:\r
+    if OverrideDir != '' and OverrideDir is not None:\r
         if OverrideDir.find('$(EFI_SOURCE)') > -1:\r
             OverrideDir = OverrideDir.replace('$(EFI_SOURCE)', EfiSource)\r
         if OverrideDir.find('$(EDK_SOURCE)') > -1:\r
@@ -781,23 +781,23 @@ def ValidFile3(AllFiles, File, Workspace='', EfiSource='', EdkSource='', Dir='.'
             File = File.replace('$(EFI_SOURCE)', EfiSource)\r
             File = File.replace('$(EDK_SOURCE)', EdkSource)\r
             NewFile = AllFiles[os.path.normpath(File)]\r
-            if NewFile != None:\r
+            if NewFile is not None:\r
                 NewRelaPath = os.path.dirname(NewFile)\r
                 File = os.path.basename(NewFile)\r
                 #NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1]\r
                 break\r
 \r
         # Second check the path with override value\r
-        if OverrideDir != '' and OverrideDir != None:\r
+        if OverrideDir != '' and OverrideDir is not None:\r
             NewFile = AllFiles[os.path.normpath(os.path.join(OverrideDir, File))]\r
-            if NewFile != None:\r
+            if NewFile is not None:\r
                 #NewRelaPath = os.path.dirname(NewFile)\r
                 NewRelaPath = NewFile[:len(NewFile) - len(File.replace("..\\", '').replace("../", '')) - 1]\r
                 break\r
 \r
         # Last check the path with normal definitions\r
         NewFile = AllFiles[os.path.normpath(os.path.join(Dir, File))]\r
-        if NewFile != None:\r
+        if NewFile is not None:\r
             break\r
 \r
         # No file found\r
@@ -1062,7 +1062,7 @@ class Progressor:
         self.CodaMessage = CloseMessage\r
         self.ProgressChar = ProgressChar\r
         self.Interval = Interval\r
-        if Progressor._StopFlag == None:\r
+        if Progressor._StopFlag is None:\r
             Progressor._StopFlag = threading.Event()\r
 \r
     ## Start to print progress charater\r
@@ -1070,10 +1070,10 @@ class Progressor:
     #   @param      OpenMessage     The string printed before progress charaters\r
     #\r
     def Start(self, OpenMessage=None):\r
-        if OpenMessage != None:\r
+        if OpenMessage is not None:\r
             self.PromptMessage = OpenMessage\r
         Progressor._StopFlag.clear()\r
-        if Progressor._ProgressThread == None:\r
+        if Progressor._ProgressThread is None:\r
             Progressor._ProgressThread = threading.Thread(target=self._ProgressThreadEntry)\r
             Progressor._ProgressThread.setDaemon(False)\r
             Progressor._ProgressThread.start()\r
@@ -1084,7 +1084,7 @@ class Progressor:
     #\r
     def Stop(self, CloseMessage=None):\r
         OriginalCodaMessage = self.CodaMessage\r
-        if CloseMessage != None:\r
+        if CloseMessage is not None:\r
             self.CodaMessage = CloseMessage\r
         self.Abort()\r
         self.CodaMessage = OriginalCodaMessage\r
@@ -1107,9 +1107,9 @@ class Progressor:
     ## Abort the progress display\r
     @staticmethod\r
     def Abort():\r
-        if Progressor._StopFlag != None:\r
+        if Progressor._StopFlag is not None:\r
             Progressor._StopFlag.set()\r
-        if Progressor._ProgressThread != None:\r
+        if Progressor._ProgressThread is not None:\r
             Progressor._ProgressThread.join()\r
             Progressor._ProgressThread = None\r
 \r
@@ -1228,7 +1228,7 @@ class sdict(IterableUserDict):
         return key, value\r
 \r
     def update(self, dict=None, **kwargs):\r
-        if dict != None:\r
+        if dict is not None:\r
             for k, v in dict.items():\r
                 self[k] = v\r
         if len(kwargs):\r
@@ -1301,7 +1301,7 @@ class tdict:
             if self._Level_ > 1:\r
                 RestKeys = [self._Wildcard for i in range(0, self._Level_ - 1)]\r
 \r
-        if FirstKey == None or str(FirstKey).upper() in self._ValidWildcardList:\r
+        if FirstKey is None or str(FirstKey).upper() in self._ValidWildcardList:\r
             FirstKey = self._Wildcard\r
 \r
         if self._Single_:\r
@@ -1316,24 +1316,24 @@ class tdict:
             if FirstKey == self._Wildcard:\r
                 if FirstKey in self.data:\r
                     Value = self.data[FirstKey][RestKeys]\r
-                if Value == None:\r
+                if Value is None:\r
                     for Key in self.data:\r
                         Value = self.data[Key][RestKeys]\r
-                        if Value != None: break\r
+                        if Value is not None: break\r
             else:\r
                 if FirstKey in self.data:\r
                     Value = self.data[FirstKey][RestKeys]\r
-                if Value == None and self._Wildcard in self.data:\r
+                if Value is None and self._Wildcard in self.data:\r
                     #print "Value=None"\r
                     Value = self.data[self._Wildcard][RestKeys]\r
         else:\r
             if FirstKey == self._Wildcard:\r
                 if FirstKey in self.data:\r
                     Value = self.data[FirstKey]\r
-                if Value == None:\r
+                if Value is None:\r
                     for Key in self.data:\r
                         Value = self.data[Key]\r
-                        if Value != None: break\r
+                        if Value is not None: break\r
             else:\r
                 if FirstKey in self.data:\r
                     Value = self.data[FirstKey]\r
@@ -2066,7 +2066,7 @@ class PathClass(object):
         return hash(self.Path)\r
 \r
     def _GetFileKey(self):\r
-        if self._Key == None:\r
+        if self._Key is None:\r
             self._Key = self.Path.upper()   # + self.ToolChainFamily + self.TagName + self.ToolCode + self.Target\r
         return self._Key\r
 \r
index 584fc7f3c3a03645da1bdfc4bcfc531fc09f4ff9..d199d1e40d8e0605de8fb8dd886e79908e8e68a6 100644 (file)
@@ -299,7 +299,7 @@ def GetLibraryClassOfInf(Item, ContainerFile, WorkspaceDir, LineNo = -1):
 #\r
 def CheckPcdTokenInfo(TokenInfoString, Section, File, LineNo = -1):\r
     Format = '<TokenSpaceGuidCName>.<PcdCName>'\r
-    if TokenInfoString != '' and TokenInfoString != None:\r
+    if TokenInfoString != '' and TokenInfoString is not None:\r
         TokenInfoList = GetSplitValueList(TokenInfoString, TAB_SPLIT)\r
         if len(TokenInfoList) == 2:\r
             return True\r
@@ -550,7 +550,7 @@ def GetComponents(Lines, Key, KeyValues, CommentCharacter):
     LineList = Lines.split('\n')\r
     for Line in LineList:\r
         Line = CleanString(Line, CommentCharacter)\r
-        if Line == None or Line == '':\r
+        if Line is None or Line == '':\r
             continue\r
 \r
         if findBlock == False:\r
index 696be4c1f0b2edda292a2dfb8db1a2dc03df14e2..5dc5b85dc5a459fb03358fd9ff07571cdc1de3b1 100644 (file)
@@ -634,7 +634,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
 # @retval True The file type is correct\r
 #\r
 def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):\r
-    if CheckFilename != '' and CheckFilename != None:\r
+    if CheckFilename != '' and CheckFilename is not None:\r
         (Root, Ext) = os.path.splitext(CheckFilename)\r
         if Ext.upper() != ExtName.upper():\r
             ContainerFile = open(ContainerFilename, 'r').read()\r
@@ -662,7 +662,7 @@ def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line,
 #\r
 def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):\r
     CheckFile = ''\r
-    if CheckFilename != '' and CheckFilename != None:\r
+    if CheckFilename != '' and CheckFilename is not None:\r
         CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)\r
         if not os.path.isfile(CheckFile):\r
             ContainerFile = open(ContainerFilename, 'r').read()\r
index 387e5152309743b36c38b859e00f08c022b4eaa1..0ba7725dd5b54e3cfba6df09fd9b7712c195f7b4 100644 (file)
@@ -45,7 +45,7 @@ class TargetTxtClassObject(object):
             DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF                            : '',\r
         }\r
         self.ConfDirectoryPath = ""\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadTargetTxtFile(Filename)\r
 \r
     ## LoadTargetTxtFile\r
@@ -83,7 +83,7 @@ class TargetTxtClassObject(object):
             self.ConfDirectoryPath = os.path.dirname(FileName)\r
         except:\r
             EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=FileName)\r
-            if F != None:\r
+            if F is not None:\r
                 F.close()\r
 \r
         for Line in F:\r
@@ -144,7 +144,7 @@ class TargetTxtClassObject(object):
     # @param Dict:  The dictionary to be printed\r
     #\r
     def printDict(Dict):\r
-        if Dict != None:\r
+        if Dict is not None:\r
             KeyList = Dict.keys()\r
             for Key in KeyList:\r
                 if Dict[Key] != '':\r
index dc90b4783f2f57ef150d22180578bd435db17aa6..1ab848f1ec68af432ef04a32fcb3806ffcef71d4 100644 (file)
@@ -53,7 +53,7 @@ class ToolDefClassObject(object):
         for Env in os.environ:\r
             self.MacroDictionary["ENV(%s)" % Env] = os.environ[Env]\r
 \r
-        if FileName != None:\r
+        if FileName is not None:\r
             self.LoadToolDefFile(FileName)\r
 \r
     ## LoadToolDefFile\r
index 716155e96d29106dd9eddcee2c4027ee68a38e37..b1baf06b9ccd40a4f86b14965b271df980afd7b3 100644 (file)
@@ -89,7 +89,7 @@ class VpdInfoFile:
     #  @param offset integer value for VPD's offset in specific SKU.\r
     #\r
     def Add(self, Vpd, skuname,Offset):\r
-        if (Vpd == None):\r
+        if (Vpd is None):\r
             EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")\r
         \r
         if not (Offset >= 0 or Offset == "*"):\r
@@ -100,7 +100,7 @@ class VpdInfoFile:
                 EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, \r
                                 "Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))\r
         elif Vpd.DatumType in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64"]: \r
-            if Vpd.MaxDatumSize == None or Vpd.MaxDatumSize == "":\r
+            if Vpd.MaxDatumSize is None or Vpd.MaxDatumSize == "":\r
                 Vpd.MaxDatumSize = VpdInfoFile._MAX_SIZE_TYPE[Vpd.DatumType]\r
         else:\r
             if Vpd.MaxDatumSize <= 0:\r
@@ -122,7 +122,7 @@ class VpdInfoFile:
     #  If \r
     #  @param FilePath        The given file path which would hold VPD information\r
     def Write(self, FilePath):\r
-        if not (FilePath != None or len(FilePath) != 0):\r
+        if not (FilePath is not None or len(FilePath) != 0):\r
             EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,  \r
                             "Invalid parameter FilePath: %s." % FilePath)        \r
 \r
@@ -227,8 +227,8 @@ class VpdInfoFile:
 #  @param VpdFileName   The string path name for VPD information guid.txt\r
 # \r
 def CallExtenalBPDGTool(ToolPath, VpdFileName):\r
-    assert ToolPath != None, "Invalid parameter ToolPath"\r
-    assert VpdFileName != None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"\r
+    assert ToolPath is not None, "Invalid parameter ToolPath"\r
+    assert VpdFileName is not None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"\r
     \r
     OutputDir = os.path.dirname(VpdFileName)\r
     FileName = os.path.basename(VpdFileName)\r
@@ -250,7 +250,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
         EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X)))\r
     (out, error) = PopenObject.communicate()\r
     print out\r
-    while PopenObject.returncode == None :\r
+    while PopenObject.returncode is None :\r
         PopenObject.wait()\r
     \r
     if PopenObject.returncode != 0:\r
index e6c4495c95e77367259a4a98f9e96ce72d1b9ba5..6a8262e5e964962e97a60caa75c77cea2c60af4c 100644 (file)
@@ -44,11 +44,11 @@ def GenerateHelpText(Text, Lang):
 class CommonClass(object):\r
     def __init__(self, Usage = None, FeatureFlag = '', SupArchList = None, HelpText = ''):\r
         self.Usage = Usage\r
-        if self.Usage == None:\r
+        if self.Usage is None:\r
             self.Usage = []\r
         self.FeatureFlag = FeatureFlag\r
         self.SupArchList = SupArchList\r
-        if self.SupArchList == None:\r
+        if self.SupArchList is None:\r
             self.SupArchList = []\r
         self.HelpText = HelpText\r
         self.HelpTextList = []\r
@@ -375,13 +375,13 @@ class PcdClass(CommonClass):
         self.PcdCName = ''\r
         self.Value = ''\r
         self.Offset = ''\r
-        if self.ValidUsage == None:\r
+        if self.ValidUsage is None:\r
             self.ValidUsage = []\r
         self.SkuInfoList = SkuInfoList\r
-        if self.SkuInfoList  == None:\r
+        if self.SkuInfoList  is None:\r
             self.SkuInfoList  = {}\r
         self.SupModuleList = SupModuleList\r
-        if self.SupModuleList == None:\r
+        if self.SupModuleList is None:\r
             self.SupModuleList = []\r
         CommonClass.__init__(self)\r
         self.PcdErrors = []\r
index 41f2811430a062111eaf9a2e295bbf71d4ff7b1f..94711a9a378ad9ab8177798b84ffdeb487847a32 100644 (file)
@@ -783,14 +783,14 @@ class CParser(Parser):
 \r
                 if self.backtracking == 0:\r
                           \r
-                    if d != None:\r
+                    if d is not None:\r
                       self.function_definition_stack[-1].ModifierText = self.input.toString(d.start,d.stop)\r
                     else:\r
                       self.function_definition_stack[-1].ModifierText = ''\r
                     self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start,declarator1.stop)\r
                     self.function_definition_stack[-1].DeclLine = declarator1.start.line\r
                     self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine\r
-                    if a != None:\r
+                    if a is not None:\r
                       self.function_definition_stack[-1].LBLine = a.start.line\r
                       self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine\r
                     else:\r
@@ -920,7 +920,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                             \r
-                        if b != None:\r
+                        if b is not None:\r
                           self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start,b.stop), self.input.toString(c.start,c.stop))\r
                         else:\r
                           self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start,c.stop))\r
@@ -957,7 +957,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if t != None:\r
+                        if t is not None:\r
                           self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start,s.stop), self.input.toString(t.start,t.stop))\r
                                \r
 \r
@@ -1401,7 +1401,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if s.stop != None:\r
+                        if s.stop is not None:\r
                           self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop))\r
                                \r
 \r
@@ -1416,7 +1416,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if e.stop != None:\r
+                        if e.stop is not None:\r
                           self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop))\r
                                \r
 \r
index 5864758950ce973ccfb0094a732b24cf7b647adb..27783e617b9219bae0f796087f1cc4bac0f1ead3 100644 (file)
@@ -1299,7 +1299,7 @@ class Check(object):
             RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)\r
             for Record in RecordSet:\r
                 Name = Record[1].strip()\r
-                if Name != '' and Name != None:\r
+                if Name != '' and Name is not None:\r
                     if Name[0] == '(':\r
                         Name = Name[1:Name.find(')')]\r
                     if Name.find('(') > -1:\r
index 171600feebf9f978b6c1c74857fafd98399e02f5..fbe0c41b38b7e616c7710f078d0c4520885c13c3 100644 (file)
@@ -301,7 +301,7 @@ class CodeFragmentCollector:
                 InCharLiteral = not InCharLiteral\r
             # meet new line, then no longer in a comment for // and '#'\r
             if self.__CurrentChar() == T_CHAR_LF:\r
-                if HashComment and PPDirectiveObj != None:\r
+                if HashComment and PPDirectiveObj is not None:\r
                     if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):\r
                         PPDirectiveObj.Content += T_CHAR_LF\r
                         PPExtend = True\r
@@ -423,7 +423,7 @@ class CodeFragmentCollector:
                 InCharLiteral = not InCharLiteral\r
             # meet new line, then no longer in a comment for // and '#'\r
             if self.__CurrentChar() == T_CHAR_LF:\r
-                if HashComment and PPDirectiveObj != None:\r
+                if HashComment and PPDirectiveObj is not None:\r
                     if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):\r
                         PPDirectiveObj.Content += T_CHAR_LF\r
                         PPExtend = True\r
index 94f9a427e37016038feb5456de630b8a5cf4b722..60dfc00260f14c99ec4175988771ae1e8a5a1312 100644 (file)
@@ -178,7 +178,7 @@ class Ecc(object):
                 self.BuildMetaDataFileDatabase(SpeciDirs)\r
             if self.ScanSourceCode:\r
                 EdkLogger.quiet("Building database for Meta Data File Done!")\r
-                if SpeciDirs == None:\r
+                if SpeciDirs is None:\r
                     c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)\r
                 else:\r
                     for specificDir in SpeciDirs:\r
@@ -195,7 +195,7 @@ class Ecc(object):
     #\r
     def BuildMetaDataFileDatabase(self, SpecificDirs = None):\r
         ScanFolders = []\r
-        if SpecificDirs == None:\r
+        if SpecificDirs is None:\r
             ScanFolders.append(EccGlobalData.gTarget)\r
         else:\r
             for specificDir in SpecificDirs:    \r
@@ -346,15 +346,15 @@ class Ecc(object):
         self.SetLogLevel(Options)\r
 \r
         # Set other options\r
-        if Options.ConfigFile != None:\r
+        if Options.ConfigFile is not None:\r
             self.ConfigFile = Options.ConfigFile\r
-        if Options.OutputFile != None:\r
+        if Options.OutputFile is not None:\r
             self.OutputFile = Options.OutputFile\r
-        if Options.ReportFile != None:\r
+        if Options.ReportFile is not None:\r
             self.ReportFile = Options.ReportFile\r
-        if Options.ExceptionFile != None:\r
+        if Options.ExceptionFile is not None:\r
             self.ExceptionFile = Options.ExceptionFile\r
-        if Options.Target != None:\r
+        if Options.Target is not None:\r
             if not os.path.isdir(Options.Target):\r
                 EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)\r
             else:\r
@@ -362,15 +362,15 @@ class Ecc(object):
         else:\r
             EdkLogger.warn("Ecc", EdkLogger.ECC_ERROR, "The target source tree was not specified, using current WORKSPACE instead!")\r
             EccGlobalData.gTarget = os.path.normpath(os.getenv("WORKSPACE"))\r
-        if Options.keepdatabase != None:\r
+        if Options.keepdatabase is not None:\r
             self.IsInit = False\r
-        if Options.metadata != None and Options.sourcecode != None:\r
+        if Options.metadata is not None and Options.sourcecode is not None:\r
             EdkLogger.error("ECC", BuildToolError.OPTION_CONFLICT, ExtraData="-m and -s can't be specified at one time")\r
-        if Options.metadata != None:\r
+        if Options.metadata is not None:\r
             self.ScanSourceCode = False\r
-        if Options.sourcecode != None:\r
+        if Options.sourcecode is not None:\r
             self.ScanMetaData = False\r
-        if Options.folders != None:\r
+        if Options.folders is not None:\r
             self.OnlyScan = True\r
 \r
     ## SetLogLevel\r
@@ -380,11 +380,11 @@ class Ecc(object):
     # @param Option:  The option list including log level setting\r
     #\r
     def SetLogLevel(self, Option):\r
-        if Option.verbose != None:\r
+        if Option.verbose is not None:\r
             EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
-        elif Option.quiet != None:\r
+        elif Option.quiet is not None:\r
             EdkLogger.SetLevel(EdkLogger.QUIET)\r
-        elif Option.debug != None:\r
+        elif Option.debug is not None:\r
             EdkLogger.SetLevel(Option.debug + 1)\r
         else:\r
             EdkLogger.SetLevel(EdkLogger.INFO)\r
index a27e98c9752f75e7b9bb9abfd6f780f0540d7c3e..6b980150f53e1b050a38e1e35afa4cdce202797f 100644 (file)
@@ -116,7 +116,7 @@ class Table(object):
         SqlCommand = """select max(ID) from %s""" % self.Table\r
         Record = self.Cur.execute(SqlCommand).fetchall()\r
         Id = Record[0][0]\r
-        if Id == None:\r
+        if Id is None:\r
             Id = self.IdBase\r
         return Id\r
 \r
@@ -191,7 +191,7 @@ class TableDataModel(Table):
     def InitTable(self):\r
         EdkLogger.verbose("\nInitialize table DataModel started ...")\r
         Count = self.GetCount()\r
-        if Count != None and Count != 0:\r
+        if Count is not None and Count != 0:\r
             return\r
         for Item in DataClass.MODEL_LIST:\r
             CrossIndex = Item[1]\r
index ba478f9ecf107a95628089fb54fe8bf9f8931e9d..34ab586084f1be04ff3bbc39b17280f741a2b37a 100644 (file)
@@ -228,7 +228,7 @@ class MetaFileParser(object):
                 self.Start()\r
 \r
         # No specific ARCH or Platform given, use raw data\r
-        if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):\r
+        if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] is None):\r
             return self._RawTable.Query(*DataInfo)\r
 \r
         # Do post-process if necessary\r
@@ -564,7 +564,7 @@ class InfParser(MetaFileParser):
             self._ValueList = ['','','']\r
             # parse current line, result will be put in self._ValueList\r
             self._SectionParser[self._SectionType](self)\r
-            if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:\r
+            if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:\r
                 self._ItemType = -1\r
                 continue\r
             #\r
@@ -877,7 +877,7 @@ class DscParser(MetaFileParser):
 \r
             self._ValueList = ['', '', '']\r
             self._SectionParser[SectionType](self)\r
-            if self._ValueList == None:\r
+            if self._ValueList is None:\r
                 continue\r
             #\r
             # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,\r
@@ -1197,7 +1197,7 @@ class DscParser(MetaFileParser):
                                 File=self._FileWithError, ExtraData=' '.join(self._ValueList), \r
                                 Line=self._LineIndex+1)\r
 \r
-            if self._ValueList == None:\r
+            if self._ValueList is None:\r
                 continue \r
 \r
             NewOwner = self._IdMapping.get(Owner, -1)\r
@@ -1573,7 +1573,7 @@ class DecParser(MetaFileParser):
             # section content\r
             self._ValueList = ['','','']\r
             self._SectionParser[self._SectionType[0]](self)\r
-            if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:\r
+            if self._ValueList is None or self._ItemType == MODEL_META_DATA_DEFINE:\r
                 self._ItemType = -1\r
                 self._Comments = []\r
                 continue\r
@@ -1932,7 +1932,7 @@ class Fdf(FdfObject):
         #\r
         # Load Fdf file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             try:\r
                 self.LoadFdfFile(Filename)\r
             except Exception:\r
index 54a3016948b1fbe762296b11901c99e3cdf6dd47..9faa6b58b001ad927f33a48ef80d450da52c3741 100644 (file)
@@ -117,9 +117,9 @@ class ModuleTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>=0" % Model\r
         ValueString = "Value1,Value2,Value3,Usage,Scope1,Scope2,ID,StartLine"\r
 \r
-        if Arch != None and Arch != 'COMMON':\r
+        if Arch is not None and Arch != 'COMMON':\r
             ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch\r
-        if Platform != None and Platform != 'COMMON':\r
+        if Platform is not None and Platform != 'COMMON':\r
             ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Platform\r
 \r
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
@@ -198,7 +198,7 @@ class PackageTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>=0" % Model\r
         ValueString = "Value1,Value2,Value3,Scope1,ID,StartLine"\r
 \r
-        if Arch != None and Arch != 'COMMON':\r
+        if Arch is not None and Arch != 'COMMON':\r
             ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch\r
 \r
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
@@ -283,17 +283,17 @@ class PlatformTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>0" % Model\r
         ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"\r
 \r
-        if Scope1 != None and Scope1 != 'COMMON':\r
+        if Scope1 is not None and Scope1 != 'COMMON':\r
             ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Scope1\r
-        if Scope2 != None and Scope2 != 'COMMON':\r
+        if Scope2 is not None and Scope2 != 'COMMON':\r
             ConditionString += " AND (Scope2='%s' OR Scope2='COMMON' OR Scope2='DEFAULT')" % Scope2\r
 \r
-        if BelongsToItem != None:\r
+        if BelongsToItem is not None:\r
             ConditionString += " AND BelongsToItem=%s" % BelongsToItem\r
         else:\r
             ConditionString += " AND BelongsToItem<0"\r
 \r
-        if FromItem != None:\r
+        if FromItem is not None:\r
             ConditionString += " AND FromItem=%s" % FromItem\r
 \r
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
index b93588eea61a12c099ee2e57a7a1127bca5b8cd8..a86f19624c445fb4753432d571b7b7571b76d313 100644 (file)
@@ -30,14 +30,14 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
 def CreateXmlElement(Name, String, NodeList, AttributeList):\r
     Doc = xml.dom.minidom.Document()\r
     Element = Doc.createElement(Name)\r
-    if String != '' and String != None:\r
+    if String != '' and String is not None:\r
         Element.appendChild(Doc.createTextNode(String))\r
     \r
     for Item in NodeList:\r
         if type(Item) == type([]):\r
             Key = Item[0]\r
             Value = Item[1]\r
-            if Key != '' and Key != None and Value != '' and Value != None:\r
+            if Key != '' and Key is not None and Value != '' and Value is not None:\r
                 Node = Doc.createElement(Key)\r
                 Node.appendChild(Doc.createTextNode(Value))\r
                 Element.appendChild(Node)\r
@@ -46,7 +46,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
     for Item in AttributeList:\r
         Key = Item[0]\r
         Value = Item[1]\r
-        if Key != '' and Key != None and Value != '' and Value != None:\r
+        if Key != '' and Key is not None and Value != '' and Value is not None:\r
             Element.setAttribute(Key, Value)\r
     \r
     return Element\r
@@ -62,7 +62,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
 # @revel  Nodes              A list of XML nodes matching XPath style Sting.\r
 #\r
 def XmlList(Dom, String):\r
-    if String == None or String == "" or Dom == None or Dom == "":\r
+    if String is None or String == "" or Dom is None or Dom == "":\r
         return []\r
     if Dom.nodeType == Dom.DOCUMENT_NODE:\r
         Dom = Dom.documentElement\r
@@ -98,7 +98,7 @@ def XmlList(Dom, String):
 # @revel  Node               A single XML node matching XPath style Sting.\r
 #\r
 def XmlNode(Dom, String):\r
-    if String == None or String == ""  or Dom == None or Dom == "":\r
+    if String is None or String == ""  or Dom is None or Dom == "":\r
         return ""\r
     if Dom.nodeType == Dom.DOCUMENT_NODE:\r
         Dom = Dom.documentElement\r
index 39a9d8ac363a8abeb1cbe060010ad0c98b6a633c..175e2d2e043924bac9089c8d362c6e21932a2d21 100644 (file)
@@ -550,7 +550,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
     Db.UpdateIdentifierBelongsToFunction()\r
 \r
 def GetTableID(FullFileName, ErrorMsgList=None):\r
-    if ErrorMsgList == None:\r
+    if ErrorMsgList is None:\r
         ErrorMsgList = []\r
 \r
     Db = GetDB()\r
@@ -575,7 +575,7 @@ def GetIncludeFileList(FullFileName):
     if os.path.splitext(FullFileName)[1].upper() not in ('.H'):\r
         return []\r
     IFList = IncludeFileListDict.get(FullFileName)\r
-    if IFList != None:\r
+    if IFList is not None:\r
         return IFList\r
 \r
     FileID = GetTableID(FullFileName)\r
@@ -601,12 +601,12 @@ def GetFullPathOfIncludeFile(Str, IncludePathList):
     return None\r
 \r
 def GetAllIncludeFiles(FullFileName):\r
-    if AllIncludeFileListDict.get(FullFileName) != None:\r
+    if AllIncludeFileListDict.get(FullFileName) is not None:\r
         return AllIncludeFileListDict.get(FullFileName)\r
 \r
     FileDirName = os.path.dirname(FullFileName)\r
     IncludePathList = IncludePathListDict.get(FileDirName)\r
-    if IncludePathList == None:\r
+    if IncludePathList is None:\r
         IncludePathList = MetaDataParser.GetIncludeListOfFile(EccGlobalData.gWorkspace, FullFileName, GetDB())\r
         if FileDirName not in IncludePathList:\r
             IncludePathList.insert(0, FileDirName)\r
@@ -618,7 +618,7 @@ def GetAllIncludeFiles(FullFileName):
         FileName = FileName.strip('\"')\r
         FileName = FileName.lstrip('<').rstrip('>').strip()\r
         FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)\r
-        if FullPath != None:\r
+        if FullPath is not None:\r
             IncludeFileQueue.append(FullPath)\r
 \r
     i = 0\r
@@ -629,7 +629,7 @@ def GetAllIncludeFiles(FullFileName):
             FileName = FileName.strip('\"')\r
             FileName = FileName.lstrip('<').rstrip('>').strip()\r
             FullPath = GetFullPathOfIncludeFile(FileName, IncludePathList)\r
-            if FullPath != None and FullPath not in IncludeFileQueue:\r
+            if FullPath is not None and FullPath not in IncludeFileQueue:\r
                 IncludeFileQueue.insert(i + 1, FullPath)\r
         i += 1\r
 \r
@@ -853,7 +853,7 @@ def DiffModifier(Str1, Str2):
 def GetTypedefDict(FullFileName):\r
 \r
     Dict = ComplexTypeDict.get(FullFileName)\r
-    if Dict != None:\r
+    if Dict is not None:\r
         return Dict\r
 \r
     FileID = GetTableID(FullFileName)\r
@@ -898,7 +898,7 @@ def GetTypedefDict(FullFileName):
 def GetSUDict(FullFileName):\r
 \r
     Dict = SUDict.get(FullFileName)\r
-    if Dict != None:\r
+    if Dict is not None:\r
         return Dict\r
 \r
     FileID = GetTableID(FullFileName)\r
@@ -983,9 +983,9 @@ def StripComments(Str):
 \r
 def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):\r
     Value = TypedefDict.get(Type)\r
-    if Value == None:\r
+    if Value is None:\r
         Value = SUDict.get(Type)\r
-    if Value == None:\r
+    if Value is None:\r
         return None\r
 \r
     LBPos = Value.find('{')\r
@@ -994,11 +994,11 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
         for FT in FTList:\r
             if FT not in ('struct', 'union'):\r
                 Value = TypedefDict.get(FT)\r
-                if Value == None:\r
+                if Value is None:\r
                     Value = SUDict.get(FT)\r
                 break\r
 \r
-        if Value == None:\r
+        if Value is None:\r
             return None\r
 \r
         LBPos = Value.find('{')\r
@@ -1025,11 +1025,11 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict):
     return None\r
 \r
 def GetRealType(Type, TypedefDict, TargetType=None):\r
-    if TargetType != None and Type == TargetType:\r
+    if TargetType is not None and Type == TargetType:\r
             return Type\r
     while TypedefDict.get(Type):\r
         Type = TypedefDict.get(Type)\r
-        if TargetType != None and Type == TargetType:\r
+        if TargetType is not None and Type == TargetType:\r
             return Type\r
     return Type\r
 \r
@@ -1043,10 +1043,10 @@ def GetTypeInfo(RefList, Modifier, FullFileName, TargetType=None):
     while Index < len(RefList):\r
         FieldName = RefList[Index]\r
         FromType = GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict)\r
-        if FromType == None:\r
+        if FromType is None:\r
             return None\r
         # we want to determine the exact type.\r
-        if TargetType != None:\r
+        if TargetType is not None:\r
             Type = FromType.split()[0]\r
         # we only want to check if it is a pointer\r
         else:\r
@@ -1151,7 +1151,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
 #            Type = GetDataTypeFromModifier(Result[0]).split()[-1]\r
             TypeList = GetDataTypeFromModifier(Result[0]).split()\r
             Type = TypeList[-1]\r
-            if len(TypeList) > 1 and StarList != None:\r
+            if len(TypeList) > 1 and StarList is not None:\r
                 for Star in StarList:\r
                     Type = Type.strip()\r
                     Type = Type.rstrip(Star)\r
@@ -1174,7 +1174,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
                 Type = TypeList[-1]\r
                 if Type == '*' and len(TypeList) >= 2:\r
                     Type = TypeList[-2]\r
-                if len(TypeList) > 1 and StarList != None:\r
+                if len(TypeList) > 1 and StarList is not None:\r
                     for Star in StarList:\r
                         Type = Type.strip()\r
                         Type = Type.rstrip(Star)\r
@@ -1199,7 +1199,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
         else:\r
             TypeList = GetDataTypeFromModifier(Result[0]).split()\r
             Type = TypeList[-1]\r
-            if len(TypeList) > 1 and StarList != None:\r
+            if len(TypeList) > 1 and StarList is not None:\r
                 for Star in StarList:\r
                     Type = Type.strip()\r
                     Type = Type.rstrip(Star)\r
@@ -1230,7 +1230,7 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetTy
             else:\r
                 TypeList = GetDataTypeFromModifier(Result[0]).split()\r
                 Type = TypeList[-1]\r
-                if len(TypeList) > 1 and StarList != None:\r
+                if len(TypeList) > 1 and StarList is not None:\r
                     for Star in StarList:\r
                         Type = Type.strip()\r
                         Type = Type.rstrip(Star)\r
@@ -1939,12 +1939,12 @@ def CheckPointerNullComparison(FullFileName):
     p = GetFuncDeclPattern()\r
     for Str in PSL:\r
         FuncRecord = GetFuncContainsPE(Str[1], FL)\r
-        if FuncRecord == None:\r
+        if FuncRecord is None:\r
             continue\r
 \r
         for Exp in GetPredicateListFromPredicateExpStr(Str[0]):\r
             PredInfo = SplitPredicateStr(Exp)\r
-            if PredInfo[1] == None:\r
+            if PredInfo[1] is None:\r
                 PredVarStr = PredInfo[0][0].strip()\r
                 IsFuncCall = False\r
                 SearchInCache = False\r
@@ -1966,7 +1966,7 @@ def CheckPointerNullComparison(FullFileName):
                     continue\r
                 if SearchInCache:\r
                     Type = FuncReturnTypeDict.get(PredVarStr)\r
-                    if Type != None:\r
+                    if Type is not None:\r
                         if Type.find('*') != -1 and Type != 'BOOLEAN*':\r
                             PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
                         continue\r
@@ -1977,7 +1977,7 @@ def CheckPointerNullComparison(FullFileName):
                 Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, None, StarList)\r
                 if SearchInCache:\r
                     FuncReturnTypeDict[PredVarStr] = Type\r
-                if Type == None:\r
+                if Type is None:\r
                     continue\r
                 Type = GetTypeFromArray(Type, PredVarStr)\r
                 if Type.find('*') != -1 and Type != 'BOOLEAN*':\r
@@ -2018,12 +2018,12 @@ def CheckNonBooleanValueComparison(FullFileName):
     p = GetFuncDeclPattern()\r
     for Str in PSL:\r
         FuncRecord = GetFuncContainsPE(Str[1], FL)\r
-        if FuncRecord == None:\r
+        if FuncRecord is None:\r
             continue\r
 \r
         for Exp in GetPredicateListFromPredicateExpStr(Str[0]):\r
             PredInfo = SplitPredicateStr(Exp)\r
-            if PredInfo[1] == None:\r
+            if PredInfo[1] is None:\r
                 PredVarStr = PredInfo[0][0].strip()\r
                 IsFuncCall = False\r
                 SearchInCache = False\r
@@ -2046,7 +2046,7 @@ def CheckNonBooleanValueComparison(FullFileName):
 \r
                 if SearchInCache:\r
                     Type = FuncReturnTypeDict.get(PredVarStr)\r
-                    if Type != None:\r
+                    if Type is not None:\r
                         if Type.find('BOOLEAN') == -1:\r
                             PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
                         continue\r
@@ -2056,7 +2056,7 @@ def CheckNonBooleanValueComparison(FullFileName):
                 Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)\r
                 if SearchInCache:\r
                     FuncReturnTypeDict[PredVarStr] = Type\r
-                if Type == None:\r
+                if Type is None:\r
                     continue\r
                 if Type.find('BOOLEAN') == -1:\r
                     PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_NO_BOOLEAN_OPERATOR, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
@@ -2097,7 +2097,7 @@ def CheckBooleanValueComparison(FullFileName):
     p = GetFuncDeclPattern()\r
     for Str in PSL:\r
         FuncRecord = GetFuncContainsPE(Str[1], FL)\r
-        if FuncRecord == None:\r
+        if FuncRecord is None:\r
             continue\r
 \r
         for Exp in GetPredicateListFromPredicateExpStr(Str[0]):\r
@@ -2125,7 +2125,7 @@ def CheckBooleanValueComparison(FullFileName):
 \r
                 if SearchInCache:\r
                     Type = FuncReturnTypeDict.get(PredVarStr)\r
-                    if Type != None:\r
+                    if Type is not None:\r
                         if Type.find('BOOLEAN') != -1:\r
                             PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
                         continue\r
@@ -2136,7 +2136,7 @@ def CheckBooleanValueComparison(FullFileName):
                 Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList)\r
                 if SearchInCache:\r
                     FuncReturnTypeDict[PredVarStr] = Type\r
-                if Type == None:\r
+                if Type is None:\r
                     continue\r
                 if Type.find('BOOLEAN') != -1:\r
                     PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])\r
index 41f2811430a062111eaf9a2e295bbf71d4ff7b1f..94711a9a378ad9ab8177798b84ffdeb487847a32 100644 (file)
@@ -783,14 +783,14 @@ class CParser(Parser):
 \r
                 if self.backtracking == 0:\r
                           \r
-                    if d != None:\r
+                    if d is not None:\r
                       self.function_definition_stack[-1].ModifierText = self.input.toString(d.start,d.stop)\r
                     else:\r
                       self.function_definition_stack[-1].ModifierText = ''\r
                     self.function_definition_stack[-1].DeclText = self.input.toString(declarator1.start,declarator1.stop)\r
                     self.function_definition_stack[-1].DeclLine = declarator1.start.line\r
                     self.function_definition_stack[-1].DeclOffset = declarator1.start.charPositionInLine\r
-                    if a != None:\r
+                    if a is not None:\r
                       self.function_definition_stack[-1].LBLine = a.start.line\r
                       self.function_definition_stack[-1].LBOffset = a.start.charPositionInLine\r
                     else:\r
@@ -920,7 +920,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                             \r
-                        if b != None:\r
+                        if b is not None:\r
                           self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, self.input.toString(b.start,b.stop), self.input.toString(c.start,c.stop))\r
                         else:\r
                           self.StoreTypedefDefinition(a.line, a.charPositionInLine, d.line, d.charPositionInLine, '', self.input.toString(c.start,c.stop))\r
@@ -957,7 +957,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if t != None:\r
+                        if t is not None:\r
                           self.StoreVariableDeclaration(s.start.line, s.start.charPositionInLine, t.start.line, t.start.charPositionInLine, self.input.toString(s.start,s.stop), self.input.toString(t.start,t.stop))\r
                                \r
 \r
@@ -1401,7 +1401,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if s.stop != None:\r
+                        if s.stop is not None:\r
                           self.StoreStructUnionDefinition(s.start.line, s.start.charPositionInLine, s.stop.line, s.stop.charPositionInLine, self.input.toString(s.start,s.stop))\r
                                \r
 \r
@@ -1416,7 +1416,7 @@ class CParser(Parser):
                         return \r
                     if self.backtracking == 0:\r
                           \r
-                        if e.stop != None:\r
+                        if e.stop is not None:\r
                           self.StoreEnumerationDefinition(e.start.line, e.start.charPositionInLine, e.stop.line, e.stop.charPositionInLine, self.input.toString(e.start,e.stop))\r
                                \r
 \r
index bb78a0f882d539e7269981f66126ef8e461016ba..b977a9d5322c2d78c385a89a51299a3d0bc5f182 100644 (file)
@@ -291,7 +291,7 @@ class CodeFragmentCollector:
                 InCharLiteral = not InCharLiteral\r
             # meet new line, then no longer in a comment for // and '#'\r
             if self.__CurrentChar() == T_CHAR_LF:\r
-                if HashComment and PPDirectiveObj != None:\r
+                if HashComment and PPDirectiveObj is not None:\r
                     if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):\r
                         PPDirectiveObj.Content += T_CHAR_LF\r
                         PPExtend = True\r
index 5029f7369d4aa838bc5712e53a136c1cdca54da9..c4164199acf3ce972b3072d71d2a2e518d4fa707 100644 (file)
@@ -579,11 +579,11 @@ class Eot(object):
     #  @param Option: The option list including log level setting\r
     #\r
     def SetLogLevel(self, Option):\r
-        if Option.verbose != None:\r
+        if Option.verbose is not None:\r
             EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
-        elif Option.quiet != None:\r
+        elif Option.quiet is not None:\r
             EdkLogger.SetLevel(EdkLogger.QUIET)\r
-        elif Option.debug != None:\r
+        elif Option.debug is not None:\r
             EdkLogger.SetLevel(Option.debug + 1)\r
         else:\r
             EdkLogger.SetLevel(EdkLogger.INFO)\r
index 0f742c7d86c277d7a39f363ca4e4792bd7f38248..affca4e71e8aa00604d326b5a98ae24a5f3144d2 100644 (file)
@@ -52,7 +52,7 @@ class Image(array):
         return array.__new__(cls, 'B')\r
 \r
     def __init__(m, ID=None):\r
-        if ID == None:\r
+        if ID is None:\r
             m._ID_ = str(uuid.uuid1()).upper()\r
         else:\r
             m._ID_ = ID\r
@@ -208,7 +208,7 @@ class FirmwareVolume(Image):
         return (CouldBeLoaded, DepexString, FileDepex)\r
 \r
     def Dispatch(self, Db = None):\r
-        if Db == None:\r
+        if Db is None:\r
             return False\r
         self.UnDispatchedFfsDict = copy.copy(self.FfsDict)\r
         # Find PeiCore, DexCore, PeiPriori, DxePriori first\r
@@ -236,15 +236,15 @@ class FirmwareVolume(Image):
                 continue\r
 \r
         # Parse SEC_CORE first\r
-        if FfsSecCoreGuid != None:\r
+        if FfsSecCoreGuid is not None:\r
             self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid)\r
             self.LoadPpi(Db, FfsSecCoreGuid)\r
 \r
         # Parse PEI first\r
-        if FfsPeiCoreGuid != None:\r
+        if FfsPeiCoreGuid is not None:\r
             self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid)\r
             self.LoadPpi(Db, FfsPeiCoreGuid)\r
-            if FfsPeiPrioriGuid != None:\r
+            if FfsPeiPrioriGuid is not None:\r
                 # Load PEIM described in priori file\r
                 FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid)\r
                 if len(FfsPeiPriori.Sections) == 1:\r
@@ -263,10 +263,10 @@ class FirmwareVolume(Image):
         self.DisPatchPei(Db)\r
 \r
         # Parse DXE then\r
-        if FfsDxeCoreGuid != None:\r
+        if FfsDxeCoreGuid is not None:\r
             self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid)\r
             self.LoadProtocol(Db, FfsDxeCoreGuid)\r
-            if FfsDxePrioriGuid != None:\r
+            if FfsDxePrioriGuid is not None:\r
                 # Load PEIM described in priori file\r
                 FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid)\r
                 if len(FfsDxePriori.Sections) == 1:\r
@@ -383,7 +383,7 @@ class FirmwareVolume(Image):
                     IsInstalled = True\r
                     NewFfs = self.UnDispatchedFfsDict.pop(FfsID)\r
                     NewFfs.Depex = DepexString\r
-                    if FileDepex != None:\r
+                    if FileDepex is not None:\r
                         ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0])\r
                     else:\r
                         ScheduleList[FfsID] = NewFfs\r
@@ -471,7 +471,7 @@ class FirmwareVolume(Image):
             FfsId = repr(FfsObj)\r
             if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \\r
                 or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0):\r
-                if LastFfsObj != None:\r
+                if LastFfsObj is not None:\r
                     LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj)\r
             else:\r
                 if FfsId in self.FfsDict:\r
@@ -480,7 +480,7 @@ class FirmwareVolume(Image):
                                     % (FfsObj.Guid, FfsObj.Offset,\r
                                        self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset))\r
                 self.FfsDict[FfsId] = FfsObj\r
-                if LastFfsObj != None:\r
+                if LastFfsObj is not None:\r
                     LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj)\r
 \r
             FfsStartAddress += len(FfsObj)\r
@@ -527,11 +527,11 @@ class CompressedImage(Image):
 \r
     def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None):\r
         Image.__init__(m)\r
-        if UncompressedLength != None:\r
+        if UncompressedLength is not None:\r
             m.UncompressedLength = UncompressedLength\r
-        if CompressionType != None:\r
+        if CompressionType is not None:\r
             m.CompressionType = CompressionType\r
-        if CompressedData != None:\r
+        if CompressedData is not None:\r
             m.Data = CompressedData\r
 \r
     def __str__(m):\r
@@ -607,13 +607,13 @@ class GuidDefinedImage(Image):
 \r
     def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None):\r
         Image.__init__(m)\r
-        if SectionDefinitionGuid != None:\r
+        if SectionDefinitionGuid is not None:\r
             m.SectionDefinitionGuid = SectionDefinitionGuid\r
-        if DataOffset != None:\r
+        if DataOffset is not None:\r
             m.DataOffset = DataOffset\r
-        if Attributes != None:\r
+        if Attributes is not None:\r
             m.Attributes = Attributes\r
-        if Data != None:\r
+        if Data is not None:\r
             m.Data = Data\r
 \r
     def __str__(m):\r
@@ -791,7 +791,7 @@ class Depex(Image):
                 else:\r
                     CurrentData = m._OPCODE_\r
                 m._ExprList.append(Token)\r
-                if CurrentData == None:\r
+                if CurrentData is None:\r
                     break\r
         return m._ExprList\r
 \r
@@ -867,9 +867,9 @@ class Section(Image):
     def __init__(m, Type=None, Size=None):\r
         Image.__init__(m)\r
         m._Alignment = 1\r
-        if Type != None:\r
+        if Type is not None:\r
             m.Type = Type\r
-        if Size != None:\r
+        if Size is not None:\r
             m.Size = Size\r
 \r
     def __str__(m):\r
@@ -1283,7 +1283,7 @@ class LinkMap:
             for Line in MapFile:\r
                 Line = Line.strip()\r
                 if not MappingStart:\r
-                    if MappingTitle.match(Line) != None:\r
+                    if MappingTitle.match(Line) is not None:\r
                         MappingStart = True\r
                     continue\r
                 ResultList = MappingFormat.findall(Line)\r
index 6bb2c5f9f1d63b05266fec7f3e6795d96cf3dbca..8867bb5dc23a7ea97a7b29431e33a7dfe2cc3c2a 100644 (file)
@@ -52,7 +52,7 @@ class EdkInfParser(object):
         self.SourceOverridePath = SourceOverridePath\r
 \r
         # Load Inf file if filename is not None\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.LoadInfFile(Filename)\r
 \r
         if SourceFileList:\r
index 386e3eb8ec05d747d6ead55c3e0ff26bd3421616..7435b4d7c9308cde8fb3c0d1441874eea97f9e5f 100644 (file)
@@ -234,7 +234,7 @@ class Report(object):
     #\r
     def GenerateFfs(self, FfsObj):\r
         self.FfsIndex = self.FfsIndex + 1\r
-        if FfsObj != None and FfsObj.Type in [0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xA]:\r
+        if FfsObj is not None and FfsObj.Type in [0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xA]:\r
             FfsGuid = FfsObj.Guid\r
             FfsOffset = FfsObj._OFF_\r
             FfsName = 'Unknown-Module'\r
index 70e2e5a3baf23e86b8b9e11af8f3913744df450a..92a74670ed25eb76dfa982e9c3917fd28b63b3c9 100644 (file)
@@ -75,11 +75,11 @@ class AprioriSection (AprioriSectionClassObject):
                 InfFileName = NormPath(FfsObj.InfFileName)\r
                 Arch = FfsObj.GetCurrentArch()\r
 \r
-                if Arch != None:\r
+                if Arch is not None:\r
                     Dict['$(ARCH)'] = Arch\r
                 InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)\r
 \r
-                if Arch != None:\r
+                if Arch is not None:\r
                     Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
                     Guid = Inf.Guid\r
 \r
index e03d78995737eab2ab05fbc66acd9501496755c0..9332f016f7da8db4d4727fa650f82cafd2269751 100644 (file)
@@ -159,7 +159,7 @@ class Capsule (CapsuleClassObject) :
                 if not os.path.isabs(fmp.ImageFile):\r
                     CapInputFile = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, fmp.ImageFile)\r
                 CapOutputTmp = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName) + '.tmp'\r
-                if ExternalTool == None:\r
+                if ExternalTool is None:\r
                     EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % fmp.Certificate_Guid)\r
                 else:\r
                     CmdOption += ExternalTool\r
index 56e71a35453b92edf1b77d62dc0e1e28d7a15904..08ab48669f4546ee0a9c07eaf5ba1936f42eddbd 100644 (file)
@@ -55,7 +55,7 @@ class CompressSection (CompressSectionClassObject) :
     #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):\r
 \r
-        if FfsInf != None:\r
+        if FfsInf is not None:\r
             self.CompType = FfsInf.__ExtendMacro__(self.CompType)\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
 \r
@@ -67,13 +67,13 @@ class CompressSection (CompressSectionClassObject) :
             Index = Index + 1\r
             SecIndex = '%s.%d' %(SecNum, Index)\r
             ReturnSectList, AlignValue = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict, IsMakefile=IsMakefile)\r
-            if AlignValue != None:\r
-                if MaxAlign == None:\r
+            if AlignValue is not None:\r
+                if MaxAlign is None:\r
                     MaxAlign = AlignValue\r
                 if GenFdsGlobalVariable.GetAlignment (AlignValue) > GenFdsGlobalVariable.GetAlignment (MaxAlign):\r
                     MaxAlign = AlignValue\r
             if ReturnSectList != []:\r
-                if AlignValue == None:\r
+                if AlignValue is None:\r
                     AlignValue = "1"\r
                 for FileData in ReturnSectList:\r
                     SectFiles += (FileData,)\r
index 2d2975f75c0f5ae0ba8509a9cf6e836fcc9a6fdf..40e345eee77e92267015b2f0e467ddac22e46110 100644 (file)
@@ -52,7 +52,7 @@ class DataSection (DataSectionClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        if FfsFile != None:\r
+        if FfsFile is not None:\r
             self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)\r
             self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict, FfsFile.CurrentArch)\r
         else:\r
@@ -92,7 +92,7 @@ class DataSection (DataSectionClassObject):
 \r
         NoStrip = True\r
         if self.SecType in ('TE', 'PE32'):\r
-            if self.KeepReloc != None:\r
+            if self.KeepReloc is not None:\r
                 NoStrip = self.KeepReloc\r
 \r
         if not NoStrip:\r
index 1992d2abd8070d5d7676a42e59a0843a0e9a7621..ef30a2f083c6624025f5e2789ec2f953501b53c8 100644 (file)
@@ -86,7 +86,7 @@ class DepexSection (DepexSectionClassObject):
             for Exp in ExpList:\r
                 if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):\r
                     GuidStr = self.__FindGuidValue(Exp)\r
-                    if GuidStr == None:\r
+                    if GuidStr is None:\r
                         EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
                                         "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
 \r
index 5029ec7a18232f72dcba257446e02f73acb8fc9f..7e6c88a0594e643c97766feb76216c781c0b4714 100644 (file)
@@ -55,10 +55,10 @@ class EfiSection (EfiSectionClassObject):
     #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False) :\r
         \r
-        if self.FileName != None and self.FileName.startswith('PCD('):\r
+        if self.FileName is not None and self.FileName.startswith('PCD('):\r
             self.FileName = GenFdsGlobalVariable.GetPcdValue(self.FileName)\r
         """Prepare the parameter of GenSection"""\r
-        if FfsInf != None :\r
+        if FfsInf is not None :\r
             InfFileName = FfsInf.InfFileName\r
             SectionType = FfsInf.__ExtendMacro__(self.SectionType)\r
             Filename = FfsInf.__ExtendMacro__(self.FileName)\r
@@ -66,20 +66,20 @@ class EfiSection (EfiSectionClassObject):
             StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             NoStrip = True\r
             if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):\r
-                if FfsInf.KeepReloc != None:\r
+                if FfsInf.KeepReloc is not None:\r
                     NoStrip = FfsInf.KeepReloc\r
-                elif FfsInf.KeepRelocFromRule != None:\r
+                elif FfsInf.KeepRelocFromRule is not None:\r
                     NoStrip = FfsInf.KeepRelocFromRule\r
-                elif self.KeepReloc != None:\r
+                elif self.KeepReloc is not None:\r
                     NoStrip = self.KeepReloc\r
-                elif FfsInf.ShadowFromInfFile != None:\r
+                elif FfsInf.ShadowFromInfFile is not None:\r
                     NoStrip = FfsInf.ShadowFromInfFile\r
         else:\r
             EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s apply rule for None!" %ModuleName)\r
 \r
         """If the file name was pointed out, add it in FileList"""\r
         FileList = []\r
-        if Filename != None:\r
+        if Filename is not None:\r
             Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)\r
             # check if the path is absolute or relative\r
             if os.path.isabs(Filename):\r
@@ -107,14 +107,14 @@ class EfiSection (EfiSectionClassObject):
         if SectionType == 'VERSION':\r
 \r
             InfOverrideVerString = False\r
-            if FfsInf.Version != None:\r
+            if FfsInf.Version is not None:\r
                 #StringData = FfsInf.Version\r
                 BuildNum = FfsInf.Version\r
                 InfOverrideVerString = True\r
 \r
             if InfOverrideVerString:\r
                 #VerTuple = ('-n', '"' + StringData + '"')\r
-                if BuildNum != None and BuildNum != '':\r
+                if BuildNum is not None and BuildNum != '':\r
                     BuildNumTuple = ('-j', BuildNum)\r
                 else:\r
                     BuildNumTuple = tuple()\r
@@ -136,7 +136,7 @@ class EfiSection (EfiSectionClassObject):
                     VerString = f.read()\r
                     f.close()\r
                     BuildNum = VerString\r
-                    if BuildNum != None and BuildNum != '':\r
+                    if BuildNum is not None and BuildNum != '':\r
                         BuildNumTuple = ('-j', BuildNum)\r
                     GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                                         #Ui=VerString,\r
@@ -146,7 +146,7 @@ class EfiSection (EfiSectionClassObject):
 \r
             else:\r
                 BuildNum = StringData\r
-                if BuildNum != None and BuildNum != '':\r
+                if BuildNum is not None and BuildNum != '':\r
                     BuildNumTuple = ('-j', BuildNum)\r
                 else:\r
                     BuildNumTuple = tuple()\r
@@ -173,7 +173,7 @@ class EfiSection (EfiSectionClassObject):
         elif SectionType == 'UI':\r
 \r
             InfOverrideUiString = False\r
-            if FfsInf.Ui != None:\r
+            if FfsInf.Ui is not None:\r
                 StringData = FfsInf.Ui\r
                 InfOverrideUiString = True\r
 \r
@@ -196,7 +196,7 @@ class EfiSection (EfiSectionClassObject):
                                                         Ui=UiString, IsMakefile=IsMakefile)\r
                     OutputFileList.append(OutputFile)\r
             else:\r
-                if StringData != None and len(StringData) > 0:\r
+                if StringData is not None and len(StringData) > 0:\r
                     UiTuple = ('-n', '"' + StringData + '"')\r
                 else:\r
                     UiTuple = tuple()\r
index 9903e9570cf928e0ab5fd743fd86771b900de034..8a894f1528165c38638746fcdccc524552a0077f 100644 (file)
@@ -639,7 +639,7 @@ class FdfParser:
                     if not MacroVal:\r
                         if Macro in MacroDict:\r
                             MacroVal = MacroDict[Macro]\r
-                    if MacroVal != None:\r
+                    if MacroVal is not None:\r
                         IncFileName = IncFileName.replace('$(' + Macro + ')', MacroVal, 1)\r
                         if MacroVal.find('$(') != -1:\r
                             PreIndex = StartPos\r
@@ -687,7 +687,7 @@ class FdfParser:
                 # list index of the insertion, note that line number is 'CurrentLine + 1'\r
                 InsertAtLine = CurrentLine\r
                 ParentProfile = GetParentAtLine (CurrentLine)\r
-                if ParentProfile != None:\r
+                if ParentProfile is not None:\r
                     ParentProfile.IncludeFileList.insert(0, IncFileProfile)\r
                     IncFileProfile.Level = ParentProfile.Level + 1\r
                 IncFileProfile.InsertStartLineNumber = InsertAtLine + 1\r
@@ -763,7 +763,7 @@ class FdfParser:
                     while StartPos != -1 and EndPos != -1 and self.__Token not in ['!ifdef', '!ifndef', '!if', '!elseif']:\r
                         MacroName = CurLine[StartPos+2 : EndPos]\r
                         MacorValue = self.__GetMacroValue(MacroName)\r
-                        if MacorValue != None:\r
+                        if MacorValue is not None:\r
                             CurLine = CurLine.replace('$(' + MacroName + ')', MacorValue, 1)\r
                             if MacorValue.find('$(') != -1:\r
                                 PreIndex = StartPos\r
@@ -1136,7 +1136,7 @@ class FdfParser:
 \r
         if not self.__GetNextToken():\r
             return False\r
-        if gGuidPattern.match(self.__Token) != None:\r
+        if gGuidPattern.match(self.__Token) is not None:\r
             return True\r
         else:\r
             self.__UndoToken()\r
@@ -1412,7 +1412,7 @@ class FdfParser:
             #'\n\tGot Token: \"%s\" from File %s\n' % (self.__Token, FileLineTuple[0]) + \\r
             # At this point, the closest parent would be the included file itself\r
             Profile = GetParentAtLine(X.OriginalLineNumber)\r
-            if Profile != None:\r
+            if Profile is not None:\r
                 X.Message += ' near line %d, column %d: %s' \\r
                 % (X.LineNumber, 0, Profile.FileLinesList[X.LineNumber-1])\r
             else:\r
@@ -1540,7 +1540,7 @@ class FdfParser:
         while self.__GetTokenStatements(FdObj):\r
             pass\r
         for Attr in ("BaseAddress", "Size", "ErasePolarity"):\r
-            if getattr(FdObj, Attr) == None:\r
+            if getattr(FdObj, Attr) is None:\r
                 self.__GetNextToken()\r
                 raise Warning("Keyword %s missing" % Attr, self.FileName, self.CurrentLineNumber)\r
 \r
@@ -1695,7 +1695,7 @@ class FdfParser:
             IsBlock = True\r
         \r
             Item = Obj.BlockSizeList[-1]\r
-            if Item[0] == None or Item[1] == None:\r
+            if Item[0] is None or Item[1] is None:\r
                 raise Warning("expected block statement", self.FileName, self.CurrentLineNumber)\r
         return IsBlock\r
 \r
@@ -1863,7 +1863,7 @@ class FdfParser:
     #\r
     def __GetRegionLayout(self, Fd):\r
         Offset = self.__CalcRegionExpr() \r
-        if Offset == None:\r
+        if Offset is None:\r
             return False\r
 \r
         RegionObj = Region.Region()\r
@@ -1874,7 +1874,7 @@ class FdfParser:
             raise Warning("expected '|'", self.FileName, self.CurrentLineNumber)\r
 \r
         Size = self.__CalcRegionExpr()\r
-        if Size == None:\r
+        if Size is None:\r
             raise Warning("expected Region Size", self.FileName, self.CurrentLineNumber)\r
         RegionObj.Size = Size\r
 \r
@@ -2974,7 +2974,7 @@ class FdfParser:
 \r
             FvImageSectionObj = FvImageSection.FvImageSection()\r
             FvImageSectionObj.Alignment = AlignValue\r
-            if FvObj != None:\r
+            if FvObj is not None:\r
                 FvImageSectionObj.Fv = FvObj\r
                 FvImageSectionObj.FvName = None\r
             else:\r
@@ -3791,7 +3791,7 @@ class FdfParser:
             Rule.CheckSum = CheckSum\r
             Rule.Fixed = Fixed\r
             Rule.KeyStringList = KeyStringList\r
-            if KeepReloc != None:\r
+            if KeepReloc is not None:\r
                 Rule.KeepReloc = KeepReloc\r
 \r
             while True:\r
@@ -3847,7 +3847,7 @@ class FdfParser:
             Rule.CheckSum = CheckSum\r
             Rule.Fixed = Fixed\r
             Rule.KeyStringList = KeyStringList\r
-            if KeepReloc != None:\r
+            if KeepReloc is not None:\r
                 Rule.KeepReloc = KeepReloc\r
             Rule.FileExtension = Ext\r
             Rule.FileName = self.__Token\r
@@ -3986,7 +3986,7 @@ class FdfParser:
                     EfiSectionObj.KeepReloc = False\r
                 else:\r
                     EfiSectionObj.KeepReloc = True\r
-                if Obj.KeepReloc != None and Obj.KeepReloc != EfiSectionObj.KeepReloc:\r
+                if Obj.KeepReloc is not None and Obj.KeepReloc != EfiSectionObj.KeepReloc:\r
                     raise Warning("Section type %s has reloc strip flag conflict with Rule" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)\r
             else:\r
                 raise Warning("Section type %s could not have reloc strip flag" % EfiSectionObj.SectionType, self.FileName, self.CurrentLineNumber)\r
@@ -4313,7 +4313,7 @@ class FdfParser:
             raise Warning("expected Component version", self.FileName, self.CurrentLineNumber)\r
 \r
         Pattern = re.compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$', re.DOTALL)\r
-        if Pattern.match(self.__Token) == None:\r
+        if Pattern.match(self.__Token) is None:\r
             raise Warning("Unknown version format '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
         CompStatementObj.CompVer = self.__Token\r
 \r
@@ -4577,7 +4577,7 @@ class FdfParser:
                     for elementRegionData in elementRegion.RegionDataList:\r
                         if elementRegionData.endswith(".cap"):\r
                             continue\r
-                        if elementRegionData != None and elementRegionData.upper() not in CapList:\r
+                        if elementRegionData is not None and elementRegionData.upper() not in CapList:\r
                             CapList.append(elementRegionData.upper())\r
         return CapList\r
 \r
@@ -4593,15 +4593,15 @@ class FdfParser:
     def __GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):\r
 \r
         for CapsuleDataObj in CapObj.CapsuleDataList :\r
-            if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:\r
+            if hasattr(CapsuleDataObj, 'FvName') and CapsuleDataObj.FvName is not None and CapsuleDataObj.FvName.upper() not in RefFvList:\r
                 RefFvList.append (CapsuleDataObj.FvName.upper())\r
-            elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName != None and CapsuleDataObj.FdName.upper() not in RefFdList:\r
+            elif hasattr(CapsuleDataObj, 'FdName') and CapsuleDataObj.FdName is not None and CapsuleDataObj.FdName.upper() not in RefFdList:\r
                 RefFdList.append (CapsuleDataObj.FdName.upper())            \r
-            elif CapsuleDataObj.Ffs != None:\r
+            elif CapsuleDataObj.Ffs is not None:\r
                 if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):\r
-                    if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:\r
+                    if CapsuleDataObj.Ffs.FvName is not None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:\r
                         RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())\r
-                    elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:\r
+                    elif CapsuleDataObj.Ffs.FdName is not None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:\r
                         RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())\r
                     else:\r
                         self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)\r
@@ -4624,7 +4624,7 @@ class FdfParser:
                     for elementRegionData in elementRegion.RegionDataList:\r
                         if elementRegionData.endswith(".fv"):\r
                             continue\r
-                        if elementRegionData != None and elementRegionData.upper() not in FvList:\r
+                        if elementRegionData is not None and elementRegionData.upper() not in FvList:\r
                             FvList.append(elementRegionData.upper())\r
         return FvList\r
 \r
@@ -4641,9 +4641,9 @@ class FdfParser:
 \r
         for FfsObj in FvObj.FfsList:\r
             if isinstance(FfsObj, FfsFileStatement.FileStatement):\r
-                if FfsObj.FvName != None and FfsObj.FvName.upper() not in RefFvList:\r
+                if FfsObj.FvName is not None and FfsObj.FvName.upper() not in RefFvList:\r
                     RefFvList.append(FfsObj.FvName.upper())\r
-                elif FfsObj.FdName != None and FfsObj.FdName.upper() not in RefFdList:\r
+                elif FfsObj.FdName is not None and FfsObj.FdName.upper() not in RefFdList:\r
                     RefFdList.append(FfsObj.FdName.upper())\r
                 else:\r
                     self.__GetReferencedFdFvTupleFromSection(FfsObj, RefFdList, RefFvList)\r
@@ -4664,9 +4664,9 @@ class FdfParser:
         while SectionStack != []:\r
             SectionObj = SectionStack.pop()\r
             if isinstance(SectionObj, FvImageSection.FvImageSection):\r
-                if SectionObj.FvName != None and SectionObj.FvName.upper() not in FvList:\r
+                if SectionObj.FvName is not None and SectionObj.FvName.upper() not in FvList:\r
                     FvList.append(SectionObj.FvName.upper())\r
-                if SectionObj.Fv != None and SectionObj.Fv.UiFvName != None and SectionObj.Fv.UiFvName.upper() not in FvList:\r
+                if SectionObj.Fv is not None and SectionObj.Fv.UiFvName is not None and SectionObj.Fv.UiFvName.upper() not in FvList:\r
                     FvList.append(SectionObj.Fv.UiFvName.upper())\r
                     self.__GetReferencedFdFvTuple(SectionObj.Fv, FdList, FvList)\r
 \r
index 12ec95b5650163a9b240e4b3e4e9077907987478..3fd5a9c2158a6f7d3e20779d9cb2312a53432ccd 100644 (file)
@@ -59,7 +59,7 @@ class FileStatement (FileStatementClassObject) :
     #\r
     def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None, IsMakefile=False, FvName=None):\r
         \r
-        if self.NameGuid != None and self.NameGuid.startswith('PCD('):\r
+        if self.NameGuid is not None and self.NameGuid.startswith('PCD('):\r
             PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)\r
             if len(PcdValue) == 0:\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \\r
@@ -81,7 +81,7 @@ class FileStatement (FileStatementClassObject) :
 \r
         Dict.update(self.DefineVarDict)\r
         SectionAlignments = None\r
-        if self.FvName != None :\r
+        if self.FvName is not None :\r
             Buffer = StringIO.StringIO('')\r
             if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))\r
@@ -89,14 +89,14 @@ class FileStatement (FileStatementClassObject) :
             FileName = Fv.AddToBuffer(Buffer)\r
             SectionFiles = [FileName]\r
 \r
-        elif self.FdName != None:\r
+        elif self.FdName is not None:\r
             if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
             Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
             FileName = Fd.GenFd()\r
             SectionFiles = [FileName]\r
 \r
-        elif self.FileName != None:\r
+        elif self.FileName is not None:\r
             if hasattr(self, 'FvFileType') and self.FvFileType == 'RAW':\r
                 if isinstance(self.FileName, list) and isinstance(self.SubAlignment, list) and len(self.FileName) == len(self.SubAlignment):\r
                     FileContent = ''\r
@@ -110,7 +110,7 @@ class FileStatement (FileStatementClassObject) :
                         Content = f.read()\r
                         f.close()\r
                         AlignValue = 1\r
-                        if self.SubAlignment[Index] != None:\r
+                        if self.SubAlignment[Index] is not None:\r
                             AlignValue = GenFdsGlobalVariable.GetAlignment(self.SubAlignment[Index])\r
                         if AlignValue > MaxAlignValue:\r
                             MaxAlignIndex = Index\r
@@ -151,7 +151,7 @@ class FileStatement (FileStatementClassObject) :
                         section.FvAddr = FvChildAddr.pop(0)\r
                     elif isinstance(section, GuidSection):\r
                         section.FvAddr = FvChildAddr\r
-                if FvParentAddr != None and isinstance(section, GuidSection):\r
+                if FvParentAddr is not None and isinstance(section, GuidSection):\r
                     section.FvParentAddr = FvParentAddr\r
 \r
                 if self.KeepReloc == False:\r