]> git.proxmox.com Git - mirror_edk2.git/commitdiff
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
index a348233911718de64e1890b81b1156f427e6248e..0dbffffc9a151b5529197a8d8830cf292befc2c0 100644 (file)
@@ -185,7 +185,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         InfLowerPath = str(PathClassObj).lower()\r
         if self.OverrideGuid:\r
             PathClassObj = ProcessDuplicatedInf(PathClassObj, self.OverrideGuid, GenFdsGlobalVariable.WorkSpaceDir)\r
-        if self.CurrentArch != None:\r
+        if self.CurrentArch is not None:\r
 \r
             Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
             #\r
@@ -194,14 +194,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.BaseName = Inf.BaseName\r
             self.ModuleGuid = Inf.Guid\r
             self.ModuleType = Inf.ModuleType\r
-            if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:\r
+            if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:\r
                 self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']\r
             if Inf.AutoGenVersion < 0x00010005:\r
                 self.ModuleType = Inf.ComponentType\r
             self.VersionString = Inf.Version\r
             self.BinFileList = Inf.Binaries\r
             self.SourceFileList = Inf.Sources\r
-            if self.KeepReloc == None and Inf.Shadow:\r
+            if self.KeepReloc is None and Inf.Shadow:\r
                 self.ShadowFromInfFile = Inf.Shadow\r
 \r
         else:\r
@@ -209,7 +209,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.BaseName = Inf.BaseName\r
             self.ModuleGuid = Inf.Guid\r
             self.ModuleType = Inf.ModuleType\r
-            if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:\r
+            if Inf.Specification is not None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:\r
                 self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']\r
             self.VersionString = Inf.Version\r
             self.BinFileList = Inf.Binaries\r
@@ -231,7 +231,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:\r
             EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)\r
 \r
-        if Inf._Defs != None and len(Inf._Defs) > 0:\r
+        if Inf._Defs is not None and len(Inf._Defs) > 0:\r
             self.OptRomDefs.update(Inf._Defs)\r
 \r
         self.PatchPcds = []\r
@@ -476,7 +476,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         # Allow binary type module not specify override rule in FDF file.\r
         # \r
         if len(self.BinFileList) > 0:\r
-            if self.Rule == None or self.Rule == "":\r
+            if self.Rule is None or self.Rule == "":\r
                 self.Rule = "BINARY"\r
 \r
         if not IsMakefile and GenFdsGlobalVariable.EnableGenfdsMultiThread and self.Rule != 'BINARY':\r
@@ -545,7 +545,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     def __GetRule__ (self) :\r
         CurrentArchList = []\r
-        if self.CurrentArch == None:\r
+        if self.CurrentArch is None:\r
             CurrentArchList = ['common']\r
         else:\r
             CurrentArchList.append(self.CurrentArch)\r
@@ -556,13 +556,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
                        CurrentArch.upper() + \\r
                        '.'                 + \\r
                        self.ModuleType.upper()\r
-            if self.Rule != None:\r
+            if self.Rule is not None:\r
                 RuleName = RuleName + \\r
                            '.'      + \\r
                            self.Rule.upper()\r
 \r
             Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
-            if Rule != None:\r
+            if Rule is not None:\r
                 GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
                 return Rule\r
 \r
@@ -572,7 +572,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                    '.'         + \\r
                    self.ModuleType.upper()\r
 \r
-        if self.Rule != None:\r
+        if self.Rule is not None:\r
             RuleName = RuleName + \\r
                        '.'      + \\r
                        self.Rule.upper()\r
@@ -580,11 +580,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
         GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))\r
 \r
         Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
-        if Rule != None:\r
+        if Rule is not None:\r
             GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
             return Rule\r
 \r
-        if Rule == None :\r
+        if Rule is None :\r
             EdkLogger.error("GenFds", GENFDS_ERROR, 'Don\'t Find common rule %s for INF %s' \\r
                             % (RuleName, self.InfFileName))\r
 \r
@@ -601,7 +601,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         DscArchList = []\r
         for Arch in GenFdsGlobalVariable.ArchList :\r
             PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
-            if  PlatformDataBase != None:\r
+            if  PlatformDataBase is not None:\r
                 if InfFileKey in PlatformDataBase.Modules:\r
                     DscArchList.append (Arch)\r
                 else:\r
@@ -648,7 +648,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             ArchList = CurArchList\r
 \r
         UseArchList = TargetArchList\r
-        if self.UseArch != None:\r
+        if self.UseArch is not None:\r
             UseArchList = []\r
             UseArchList.append(self.UseArch)\r
             ArchList = list(set (UseArchList) & set (ArchList))\r
@@ -689,7 +689,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if self.OverrideGuid:\r
             FileName = self.OverrideGuid\r
         Arch = "NoneArch"\r
-        if self.CurrentArch != None:\r
+        if self.CurrentArch is not None:\r
             Arch = self.CurrentArch\r
 \r
         OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],\r
@@ -723,7 +723,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         FileList = []\r
         OutputFileList = []\r
         GenSecInputFile = None\r
-        if Rule.FileName != None:\r
+        if Rule.FileName is not None:\r
             GenSecInputFile = self.__ExtendMacro__(Rule.FileName)\r
             if os.path.isabs(GenSecInputFile):\r
                 GenSecInputFile = os.path.normpath(GenSecInputFile)\r
@@ -748,11 +748,11 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
         NoStrip = True\r
         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
-            if self.KeepReloc != None:\r
+            if self.KeepReloc is not None:\r
                 NoStrip = self.KeepReloc\r
-            elif Rule.KeepReloc != None:\r
+            elif Rule.KeepReloc is not None:\r
                 NoStrip = Rule.KeepReloc\r
-            elif self.ShadowFromInfFile != None:\r
+            elif self.ShadowFromInfFile is not None:\r
                 NoStrip = self.ShadowFromInfFile\r
 \r
         if FileList != [] :\r
@@ -868,7 +868,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             InputSection.append(InputFile)\r
             SectionAlignments.append(Rule.SectAlignment)\r
 \r
-        if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):\r
+        if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):\r
             PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)\r
             if len(PcdValue) == 0:\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \\r
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):\r
         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
-            if Rule.KeepReloc != None:\r
+            if Rule.KeepReloc is not None:\r
                 self.KeepRelocFromRule = Rule.KeepReloc\r
         SectFiles = []\r
         SectAlignments = []\r
@@ -957,7 +957,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     Sect.FvAddr = FvChildAddr.pop(0)\r
                 elif isinstance(Sect, GuidSection):\r
                     Sect.FvAddr = FvChildAddr\r
-            if FvParentAddr != None and isinstance(Sect, GuidSection):\r
+            if FvParentAddr is not None and isinstance(Sect, GuidSection):\r
                 Sect.FvParentAddr = FvParentAddr\r
             \r
             if Rule.KeyStringList != []:\r
@@ -1040,7 +1040,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     def __GenComplexFileFfs__(self, Rule, InputFile, Alignments, MakefilePath = None):\r
 \r
-        if Rule.NameGuid != None and Rule.NameGuid.startswith('PCD('):\r
+        if Rule.NameGuid is not None and Rule.NameGuid.startswith('PCD('):\r
             PcdValue = GenFdsGlobalVariable.GetPcdValue(Rule.NameGuid)\r
             if len(PcdValue) == 0:\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, '%s NOT defined.' \\r
@@ -1079,7 +1079,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if Rule.CheckSum != False:\r
             result += ('-s',)\r
 \r
-        if Rule.Alignment != None and Rule.Alignment != '':\r
+        if Rule.Alignment is not None and Rule.Alignment != '':\r
             result += ('-a', Rule.Alignment)\r
 \r
         return result\r
index c0b869d250f1f484ebf1d26f0ce646a23f7acb9e..14e36b88596601df317844f6d49b3f0d55025bd2 100644 (file)
@@ -70,14 +70,14 @@ class FV (FvClassObject):
     #\r
     def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :\r
 \r
-        if BaseAddress == None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
+        if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
             return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']\r
         \r
         #\r
         # Check whether FV in Capsule is in FD flash region.\r
         # If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.\r
         #\r
-        if self.CapsuleName != None:\r
+        if self.CapsuleName is not None:\r
             for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
                 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
                 for RegionObj in FdObj.RegionList:\r
@@ -94,7 +94,7 @@ class FV (FvClassObject):
         GenFdsGlobalVariable.LargeFileInFvFlags.append(False)\r
         FFSGuid = None\r
         \r
-        if self.FvBaseAddress != None:\r
+        if self.FvBaseAddress is not None:\r
             BaseAddress = self.FvBaseAddress\r
         if not Flag:\r
             self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)\r
@@ -136,7 +136,7 @@ class FV (FvClassObject):
         FvOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName)\r
         FvOutputFile = FvOutputFile + '.Fv'\r
         # BUGBUG: FvOutputFile could be specified from FDF file (FV section, CreateFile statement)\r
-        if self.CreateFileName != None:\r
+        if self.CreateFileName is not None:\r
             FvOutputFile = self.CreateFileName\r
 \r
         if Flag:\r
@@ -163,7 +163,7 @@ class FV (FvClassObject):
             NewFvInfo = None\r
             if os.path.exists (FvInfoFileName):\r
                 NewFvInfo = open(FvInfoFileName, 'r').read()\r
-            if NewFvInfo != None and NewFvInfo != OrigFvInfo:\r
+            if NewFvInfo is not None and NewFvInfo != OrigFvInfo:\r
                 FvChildAddr = []\r
                 AddFileObj = open(FvInfoFileName, 'r')\r
                 AddrStrings = AddFileObj.readlines()\r
@@ -273,16 +273,16 @@ class FV (FvClassObject):
         # Add [Options]\r
         #\r
         self.FvInfFile.writelines("[options]" + T_CHAR_LF)\r
-        if BaseAddress != None :\r
+        if BaseAddress is not None :\r
             self.FvInfFile.writelines("EFI_BASE_ADDRESS = " + \\r
                                        BaseAddress          + \\r
                                        T_CHAR_LF)\r
 \r
-        if BlockSize != None:\r
+        if BlockSize is not None:\r
             self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \\r
                                       '0x%X' %BlockSize    + \\r
                                       T_CHAR_LF)\r
-            if BlockNum != None:\r
+            if BlockNum is not None:\r
                 self.FvInfFile.writelines("EFI_NUM_BLOCKS   = "  + \\r
                                       ' 0x%X' %BlockNum    + \\r
                                       T_CHAR_LF)\r
@@ -293,20 +293,20 @@ class FV (FvClassObject):
                     self.FvInfFile.writelines("EFI_BLOCK_SIZE  = 0x1" + T_CHAR_LF)\r
             \r
             for BlockSize in self.BlockSizeList :\r
-                if BlockSize[0] != None:\r
+                if BlockSize[0] is not None:\r
                     self.FvInfFile.writelines("EFI_BLOCK_SIZE  = "  + \\r
                                           '0x%X' %BlockSize[0]    + \\r
                                           T_CHAR_LF)\r
 \r
-                if BlockSize[1] != None:\r
+                if BlockSize[1] is not None:\r
                     self.FvInfFile.writelines("EFI_NUM_BLOCKS   = "  + \\r
                                           ' 0x%X' %BlockSize[1]    + \\r
                                           T_CHAR_LF)\r
 \r
-        if self.BsBaseAddress != None:\r
+        if self.BsBaseAddress is not None:\r
             self.FvInfFile.writelines('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \\r
                                        '0x%X' %self.BsBaseAddress)\r
-        if self.RtBaseAddress != None:\r
+        if self.RtBaseAddress is not None:\r
             self.FvInfFile.writelines('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \\r
                                       '0x%X' %self.RtBaseAddress)\r
         #\r
@@ -317,7 +317,7 @@ class FV (FvClassObject):
         self.FvInfFile.writelines("EFI_ERASE_POLARITY   = "       + \\r
                                           ' %s' %ErasePloarity    + \\r
                                           T_CHAR_LF)\r
-        if not (self.FvAttributeDict == None):\r
+        if not (self.FvAttributeDict is None):\r
             for FvAttribute in self.FvAttributeDict.keys() :\r
                 if FvAttribute == "FvUsedSizeEnable":\r
                     if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1') :\r
@@ -328,7 +328,7 @@ class FV (FvClassObject):
                                           ' = '             + \\r
                                           self.FvAttributeDict[FvAttribute] + \\r
                                           T_CHAR_LF )\r
-        if self.FvAlignment != None:\r
+        if self.FvAlignment is not None:\r
             self.FvInfFile.writelines("EFI_FVB2_ALIGNMENT_"     + \\r
                                        self.FvAlignment.strip() + \\r
                                        " = TRUE"                + \\r
@@ -337,7 +337,7 @@ class FV (FvClassObject):
         #\r
         # Generate FV extension header file\r
         #\r
-        if self.FvNameGuid == None or self.FvNameGuid == '':\r
+        if self.FvNameGuid is None or self.FvNameGuid == '':\r
             if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:\r
                 GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))\r
         \r
@@ -442,7 +442,7 @@ class FV (FvClassObject):
         # Add [Files]\r
         #\r
         self.FvInfFile.writelines("[files]" + T_CHAR_LF)\r
-        if VtfDict != None and self.UiFvName in VtfDict.keys():\r
+        if VtfDict is not None and self.UiFvName in VtfDict.keys():\r
             self.FvInfFile.writelines("EFI_FILE_NAME = "                   + \\r
                                        VtfDict.get(self.UiFvName)          + \\r
                                        T_CHAR_LF)\r
index 916ff919176cc00695af6b7bd6ad9c9d68a1897a..5026a3ffca2f2bedd0ebce3497b250c35d4ed638 100644 (file)
@@ -53,7 +53,7 @@ class FvImageSection(FvImageSectionClassObject):
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):\r
 \r
         OutputFileList = []\r
-        if self.FvFileType != None:\r
+        if self.FvFileType is not None:\r
             FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FvFileType, self.FvFileExtension)\r
             if IsSect :\r
                 return FileList, self.Alignment\r
@@ -96,20 +96,20 @@ class FvImageSection(FvImageSectionClassObject):
         #\r
         # Generate Fv\r
         #\r
-        if self.FvName != None:\r
+        if self.FvName is not None:\r
             Buffer = StringIO.StringIO('')\r
             Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)\r
-            if Fv != None:\r
+            if Fv is not None:\r
                 self.Fv = Fv\r
                 FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict, Flag=IsMakefile)\r
-                if Fv.FvAlignment != None:\r
-                    if self.Alignment == None:\r
+                if Fv.FvAlignment is not None:\r
+                    if self.Alignment is None:\r
                         self.Alignment = Fv.FvAlignment\r
                     else:\r
                         if GenFdsGlobalVariable.GetAlignment (Fv.FvAlignment) > GenFdsGlobalVariable.GetAlignment (self.Alignment):\r
                             self.Alignment = Fv.FvAlignment\r
             else:\r
-                if self.FvFileName != None:\r
+                if self.FvFileName is not None:\r
                     FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName)\r
                     if os.path.isfile(FvFileName):\r
                         FvFileObj = open (FvFileName,'rb')\r
index 26122fc09943d8ca1645296e21c513461315553a..49e26424bbfc20f94c92eb713df488efe5756bbb 100644 (file)
@@ -69,22 +69,22 @@ def main():
 \r
     EdkLogger.Initialize()\r
     try:\r
-        if Options.verbose != None:\r
+        if Options.verbose is not None:\r
             EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
             GenFdsGlobalVariable.VerboseMode = True\r
             \r
-        if Options.FixedAddress != None:\r
+        if Options.FixedAddress is not None:\r
             GenFdsGlobalVariable.FixedLoadAddress = True\r
             \r
-        if Options.quiet != None:\r
+        if Options.quiet is not None:\r
             EdkLogger.SetLevel(EdkLogger.QUIET)\r
-        if Options.debug != None:\r
+        if Options.debug is not None:\r
             EdkLogger.SetLevel(Options.debug + 1)\r
             GenFdsGlobalVariable.DebugLevel = Options.debug\r
         else:\r
             EdkLogger.SetLevel(EdkLogger.INFO)\r
 \r
-        if (Options.Workspace == None):\r
+        if (Options.Workspace is None):\r
             EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",\r
                             ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")\r
         elif not os.path.exists(Options.Workspace):\r
@@ -179,7 +179,7 @@ def main():
             # if no tool chain given in command line, get it from target.txt\r
             if not GenFdsGlobalVariable.ToolChainTag:\r
                 ToolChainList = TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]\r
-                if ToolChainList == None or len(ToolChainList) == 0:\r
+                if ToolChainList is None or len(ToolChainList) == 0:\r
                     EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.")\r
                 if len(ToolChainList) != 1:\r
                     EdkLogger.error("GenFds", OPTION_VALUE_INVALID, ExtraData="Only allows one instance for ToolChain.")\r
@@ -300,7 +300,7 @@ def main():
                                 "No such a Capsule in FDF file: %s" % Options.uiCapName)\r
 \r
         GenFdsGlobalVariable.WorkSpace = BuildWorkSpace\r
-        if ArchList != None:\r
+        if ArchList is not None:\r
             GenFdsGlobalVariable.ArchList = ArchList\r
 \r
         # Dsc Build Data will handle Pcd Settings from CommandLine.\r
@@ -340,7 +340,7 @@ def main():
         EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)\r
         ReturnCode = FORMAT_INVALID\r
     except FatalError, X:\r
-        if Options.debug != None:\r
+        if Options.debug is not None:\r
             import traceback\r
             EdkLogger.quiet(traceback.format_exc())\r
         ReturnCode = X.args[0]\r
@@ -378,7 +378,7 @@ def SingleCheckCallback(option, opt_str, value, parser):
 def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):\r
     ToolDb = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDatabase\r
     # if user not specify filter, try to deduce it from global data.\r
-    if KeyStringList == None or KeyStringList == []:\r
+    if KeyStringList is None or KeyStringList == []:\r
         Target = GenFdsGlobalVariable.TargetName\r
         ToolChain = GenFdsGlobalVariable.ToolChainTag\r
         if ToolChain not in ToolDb['TOOL_CHAIN_TAG']:\r
@@ -411,7 +411,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
                 ToolOptionKey = Key + '_' + KeyList[3] + '_FLAGS'\r
                 ToolPath = ToolDefinition.get(ToolPathKey)\r
                 ToolOption = ToolDefinition.get(ToolOptionKey)\r
-                if ToolPathTmp == None:\r
+                if ToolPathTmp is None:\r
                     ToolPathTmp = ToolPath\r
                 else:\r
                     if ToolPathTmp != ToolPath:\r
@@ -523,38 +523,38 @@ class GenFds :
         GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)\r
 \r
         GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")\r
-        if GenFds.OnlyGenerateThisCap != None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
+        if GenFds.OnlyGenerateThisCap is not None and GenFds.OnlyGenerateThisCap.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
             CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.get(GenFds.OnlyGenerateThisCap.upper())\r
-            if CapsuleObj != None:\r
+            if CapsuleObj is not None:\r
                 CapsuleObj.GenCapsule()\r
                 return\r
 \r
-        if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+        if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
             FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())\r
-            if FdObj != None:\r
+            if FdObj is not None:\r
                 FdObj.GenFd()\r
                 return\r
-        elif GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisFv == None:\r
+        elif GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisFv is None:\r
             for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
                 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
                 FdObj.GenFd()\r
 \r
         GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")\r
-        if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
+        if GenFds.OnlyGenerateThisFv is not None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
             FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())\r
-            if FvObj != None:\r
+            if FvObj is not None:\r
                 Buffer = StringIO.StringIO()\r
                 FvObj.AddToBuffer(Buffer)\r
                 Buffer.close()\r
                 return\r
-        elif GenFds.OnlyGenerateThisFv == None:\r
+        elif GenFds.OnlyGenerateThisFv is None:\r
             for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
                 Buffer = StringIO.StringIO('')\r
                 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]\r
                 FvObj.AddToBuffer(Buffer)\r
                 Buffer.close()\r
         \r
-        if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None and GenFds.OnlyGenerateThisCap == None:\r
+        if GenFds.OnlyGenerateThisFv is None and GenFds.OnlyGenerateThisFd is None and GenFds.OnlyGenerateThisCap is None:\r
             if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:\r
                 GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")\r
                 for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
@@ -592,14 +592,14 @@ class GenFds :
     def GetFvBlockSize(FvObj):\r
         DefaultBlockSize = 0x1\r
         FdObj = None\r
-        if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+        if GenFds.OnlyGenerateThisFd is not None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
             FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[GenFds.OnlyGenerateThisFd.upper()]\r
-        if FdObj == None:\r
+        if FdObj is None:\r
             for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
                 for ElementRegion in ElementFd.RegionList:\r
                     if ElementRegion.RegionType == 'FV':\r
                         for ElementRegionData in ElementRegion.RegionDataList:\r
-                            if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:\r
+                            if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:\r
                                 if FvObj.BlockSizeList != []:\r
                                     return FvObj.BlockSizeList[0][0]\r
                                 else:\r
@@ -611,7 +611,7 @@ class GenFds :
             for ElementRegion in FdObj.RegionList:\r
                     if ElementRegion.RegionType == 'FV':\r
                         for ElementRegionData in ElementRegion.RegionDataList:\r
-                            if ElementRegionData != None and ElementRegionData.upper() == FvObj.UiFvName:\r
+                            if ElementRegionData is not None and ElementRegionData.upper() == FvObj.UiFvName:\r
                                 if FvObj.BlockSizeList != []:\r
                                     return FvObj.BlockSizeList[0][0]\r
                                 else:\r
index 97e20753ae9b540ec79e5158f4cea105095f8fa1..fcb191981c95a75489a4134cc51392eaab41cea2 100644 (file)
@@ -229,7 +229,7 @@ class GenFdsGlobalVariable:
                 Source = SourceList[Index]\r
                 Index = Index + 1\r
     \r
-                if File.IsBinary and File == Source and Inf.Binaries != None and File in Inf.Binaries:\r
+                if File.IsBinary and File == Source and Inf.Binaries is not None and File in Inf.Binaries:\r
                     # Skip all files that are not binary libraries\r
                     if not Inf.LibraryClass:\r
                         continue            \r
@@ -420,7 +420,7 @@ class GenFdsGlobalVariable:
         if not os.path.exists(Output):\r
             return True\r
         # always update "Output" if no "Input" given\r
-        if Input == None or len(Input) == 0:\r
+        if Input is None or len(Input) == 0:\r
             return True\r
 \r
         # if fdf file is changed after the 'Output" is generated, update the 'Output'\r
@@ -445,9 +445,9 @@ class GenFdsGlobalVariable:
             Cmd += ["-s", Type]\r
         if CompressionType not in [None, '']:\r
             Cmd += ["-c", CompressionType]\r
-        if Guid != None:\r
+        if Guid is not None:\r
             Cmd += ["-g", Guid]\r
-        if DummyFile != None:\r
+        if DummyFile is not None:\r
             Cmd += ["--dummy", DummyFile]\r
         if GuidHdrLen not in [None, '']:\r
             Cmd += ["-l", GuidHdrLen]\r
@@ -455,7 +455,7 @@ class GenFdsGlobalVariable:
             #Add each guided attribute\r
             for Attr in GuidAttr:\r
                 Cmd += ["-r", Attr]\r
-        if InputAlign != None:\r
+        if InputAlign is not None:\r
             #Section Align is only for dummy section without section type\r
             for SecAlign in InputAlign:\r
                 Cmd += ["--sectionalign", SecAlign]\r
@@ -509,7 +509,7 @@ class GenFdsGlobalVariable:
 \r
     @staticmethod\r
     def GetAlignment (AlignString):\r
-        if AlignString == None:\r
+        if AlignString is None:\r
             return 0\r
         if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"):\r
             return int (AlignString.rstrip('K')) * 1024\r
@@ -669,13 +669,13 @@ class GenFdsGlobalVariable:
             return\r
         GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))\r
                         \r
-        if ClassCode != None:\r
+        if ClassCode is not None:\r
             Cmd += ["-l", ClassCode]\r
-        if Revision != None:\r
+        if Revision is not None:\r
             Cmd += ["-r", Revision]\r
-        if DeviceId != None:\r
+        if DeviceId is not None:\r
             Cmd += ["-i", DeviceId]\r
-        if VendorId != None:\r
+        if VendorId is not None:\r
             Cmd += ["-f", VendorId]\r
 \r
         Cmd += ["-o", Output]\r
@@ -726,7 +726,7 @@ class GenFdsGlobalVariable:
             EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))\r
         (out, error) = PopenObject.communicate()\r
 \r
-        while PopenObject.returncode == None :\r
+        while PopenObject.returncode is None :\r
             PopenObject.wait()\r
         if returnValue != [] and returnValue[0] != 0:\r
             #get command return value\r
@@ -758,7 +758,7 @@ class GenFdsGlobalVariable:
     #   @param  MacroDict     Dictionary that contains macro value pair\r
     #\r
     def MacroExtend (Str, MacroDict={}, Arch='COMMON'):\r
-        if Str == None :\r
+        if Str is None :\r
             return None\r
 \r
         Dict = {'$(WORKSPACE)'   : GenFdsGlobalVariable.WorkSpaceDir,\r
@@ -774,7 +774,7 @@ class GenFdsGlobalVariable:
 \r
         Dict['$(OUTPUT_DIRECTORY)'] = OutputDir\r
 \r
-        if MacroDict != None  and len (MacroDict) != 0:\r
+        if MacroDict is not None  and len (MacroDict) != 0:\r
             Dict.update(MacroDict)\r
 \r
         for key in Dict.keys():\r
@@ -794,7 +794,7 @@ class GenFdsGlobalVariable:
     #   @param  PcdPattern           pattern that labels a PCD.\r
     #\r
     def GetPcdValue (PcdPattern):\r
-        if PcdPattern == None :\r
+        if PcdPattern is None :\r
             return None\r
         PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')\r
         TokenSpace = PcdPair[0]\r
index ea737bb9a7ea5c251cc05d2f8197b50f622c783a..8362073f97a30c533ad4484cb53a8656a4df213b 100644 (file)
@@ -60,7 +60,7 @@ class GuidSection(GuidSectionClassObject) :
         #\r
         self.KeyStringList = KeyStringList\r
         self.CurrentArchList = GenFdsGlobalVariable.ArchList\r
-        if FfsInf != None:\r
+        if FfsInf is not None:\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
             self.NameGuid = FfsInf.__ExtendMacro__(self.NameGuid)\r
             self.SectionType = FfsInf.__ExtendMacro__(self.SectionType)\r
@@ -79,7 +79,7 @@ class GuidSection(GuidSectionClassObject) :
             if self.FvAddr != []:\r
                 #no use FvAddr when the image is processed.\r
                 self.FvAddr = []\r
-            if self.FvParentAddr != None:\r
+            if self.FvParentAddr is not None:\r
                 #no use Parent Addr when the image is processed.\r
                 self.FvParentAddr = None\r
 \r
@@ -99,20 +99,20 @@ class GuidSection(GuidSectionClassObject) :
                 if Sect.IncludeFvSection:\r
                     self.IncludeFvSection = Sect.IncludeFvSection\r
 \r
-            if align != None:\r
-                if MaxAlign == None:\r
+            if align is not None:\r
+                if MaxAlign is None:\r
                     MaxAlign = align\r
                 if GenFdsGlobalVariable.GetAlignment (align) > GenFdsGlobalVariable.GetAlignment (MaxAlign):\r
                     MaxAlign = align\r
             if ReturnSectList != []:\r
-                if align == None:\r
+                if align is None:\r
                     align = "1"\r
                 for file in ReturnSectList:\r
                     SectFile += (file,)\r
                     SectAlign.append(align)\r
 \r
-        if MaxAlign != None:\r
-            if self.Alignment == None:\r
+        if MaxAlign is not None:\r
+            if self.Alignment is None:\r
                 self.Alignment = MaxAlign\r
             else:\r
                 if GenFdsGlobalVariable.GetAlignment (MaxAlign) > GenFdsGlobalVariable.GetAlignment (self.Alignment):\r
@@ -128,21 +128,21 @@ class GuidSection(GuidSectionClassObject) :
 \r
         ExternalTool = None\r
         ExternalOption = None\r
-        if self.NameGuid != None:\r
+        if self.NameGuid is not None:\r
             ExternalTool, ExternalOption = FindExtendTool(self.KeyStringList, self.CurrentArchList, self.NameGuid)\r
 \r
         #\r
         # If not have GUID , call default\r
         # GENCRC32 section\r
         #\r
-        if self.NameGuid == None :\r
+        if self.NameGuid is None :\r
             GenFdsGlobalVariable.VerboseLogger("Use GenSection function Generate CRC32 Section")\r
             GenFdsGlobalVariable.GenerateSection(OutputFile, SectFile, Section.Section.SectionType[self.SectionType], InputAlign=SectAlign, IsMakefile=IsMakefile)\r
             OutputFileList = []\r
             OutputFileList.append(OutputFile)\r
             return OutputFileList, self.Alignment\r
         #or GUID not in External Tool List\r
-        elif ExternalTool == None:\r
+        elif ExternalTool is None:\r
             EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)\r
         else:\r
             DummyFile = OutputFile + ".dummy"\r
@@ -170,10 +170,10 @@ class GuidSection(GuidSectionClassObject) :
 \r
             FirstCall = False\r
             CmdOption = '-e'\r
-            if ExternalOption != None:\r
+            if ExternalOption is not None:\r
                 CmdOption = CmdOption + ' ' + ExternalOption\r
             if not GenFdsGlobalVariable.EnableGenfdsMultiThread:\r
-                if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr != None:\r
+                if self.ProcessRequired not in ("TRUE", "1") and self.IncludeFvSection and not FvAddrIsSet and self.FvParentAddr is not None:\r
                     #FirstCall is only set for the encapsulated flash FV image without process required attribute.\r
                     FirstCall = True\r
                 #\r
@@ -213,7 +213,7 @@ class GuidSection(GuidSectionClassObject) :
                 if self.ExtraHeaderSize != -1:\r
                     HeaderLength = str(self.ExtraHeaderSize)\r
 \r
-                if self.ProcessRequired == "NONE" and HeaderLength == None:\r
+                if self.ProcessRequired == "NONE" and HeaderLength is None:\r
                     if TempFileSize > InputFileSize:\r
                         FileHandleIn.seek(0)\r
                         BufferIn = FileHandleIn.read()\r
@@ -222,7 +222,7 @@ class GuidSection(GuidSectionClassObject) :
                         if BufferIn == BufferOut[TempFileSize - InputFileSize:]:\r
                             HeaderLength = str(TempFileSize - InputFileSize)\r
                     #auto sec guided attribute with process required\r
-                    if HeaderLength == None:\r
+                    if HeaderLength is None:\r
                         Attribute.append('PROCESSING_REQUIRED')\r
 \r
                 FileHandleIn.close()\r
@@ -253,7 +253,7 @@ class GuidSection(GuidSectionClassObject) :
                     HeaderLength = str(self.ExtraHeaderSize)\r
                 if self.AuthStatusValid in ("TRUE", "1"):\r
                     Attribute.append('AUTH_STATUS_VALID')\r
-                if self.ProcessRequired == "NONE" and HeaderLength == None:\r
+                if self.ProcessRequired == "NONE" and HeaderLength is None:\r
                     GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],\r
                                                          Guid=self.NameGuid, GuidAttr=Attribute,\r
                                                          GuidHdrLen=HeaderLength, DummyFile=DummyFile, IsMakefile=IsMakefile)\r
index ab4fae611e3395d7297ea28b5d1cbb6fbb3c8f0b..4ef9b4d0e9a81f5eb4e844ca6bdfcbe52701ea15 100644 (file)
@@ -41,7 +41,7 @@ class OptRomFileStatement:
     #\r
     def GenFfs(self, Dict = {}, IsMakefile=False):\r
         \r
-        if self.FileName != None:\r
+        if self.FileName is not None:\r
             self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
         \r
         return self.FileName\r
index 80c4bbab6effa848b416e2535c742e10f7f29c44..62d731fb9cca18666d80f0039e51b8a07ad0e7dd 100644 (file)
@@ -46,10 +46,10 @@ class OptRomInfStatement (FfsInfStatement):
     #\r
     def __GetOptRomParams(self):\r
         \r
-        if self.OverrideAttribs == None:\r
+        if self.OverrideAttribs is None:\r
             self.OverrideAttribs = OptionRom.OverrideAttribs()\r
 \r
-        if self.OverrideAttribs.NeedCompress == None:\r
+        if self.OverrideAttribs.NeedCompress is None:\r
             self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')\r
             if self.OverrideAttribs.NeedCompress is not None:\r
                 if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):\r
@@ -57,16 +57,16 @@ class OptRomInfStatement (FfsInfStatement):
                 self.OverrideAttribs.NeedCompress = \\r
                     self.OverrideAttribs.NeedCompress.upper() == 'TRUE'\r
 \r
-        if self.OverrideAttribs.PciVendorId == None:\r
+        if self.OverrideAttribs.PciVendorId is None:\r
             self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')\r
         \r
-        if self.OverrideAttribs.PciClassCode == None:\r
+        if self.OverrideAttribs.PciClassCode is None:\r
             self.OverrideAttribs.PciClassCode = self.OptRomDefs.get ('PCI_CLASS_CODE')\r
             \r
-        if self.OverrideAttribs.PciDeviceId == None:\r
+        if self.OverrideAttribs.PciDeviceId is None:\r
             self.OverrideAttribs.PciDeviceId = self.OptRomDefs.get ('PCI_DEVICE_ID')\r
             \r
-        if self.OverrideAttribs.PciRevision == None:\r
+        if self.OverrideAttribs.PciRevision is None:\r
             self.OverrideAttribs.PciRevision = self.OptRomDefs.get ('PCI_REVISION')\r
         \r
 #        InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch]  \r
@@ -121,7 +121,7 @@ class OptRomInfStatement (FfsInfStatement):
         #\r
 \r
         OutputFileList = []\r
-        if Rule.FileName != None:\r
+        if Rule.FileName is not None:\r
             GenSecInputFile = self.__ExtendMacro__(Rule.FileName)\r
             OutputFileList.append(GenSecInputFile)\r
         else:\r
@@ -143,7 +143,7 @@ class OptRomInfStatement (FfsInfStatement):
         OutputFileList = []\r
         for Sect in Rule.SectionList:\r
             if Sect.SectionType == 'PE32':\r
-                if Sect.FileName != None:\r
+                if Sect.FileName is not None:\r
                     GenSecInputFile = self.__ExtendMacro__(Sect.FileName)\r
                     OutputFileList.append(GenSecInputFile)\r
                 else:\r
index 2e61a38c1d333693bbb3912c4c770c7cfd586e26..b058415299404c92cddc80dce0ed2bb7f96f7346 100644 (file)
@@ -63,7 +63,7 @@ class OPTIONROM (OptionRomClassObject):
                 FilePathNameList = FfsFile.GenFfs(IsMakefile=Flag)\r
                 if len(FilePathNameList) == 0:\r
                     EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s not produce .efi files, so NO file could be put into option ROM." % (FfsFile.InfFileName))\r
-                if FfsFile.OverrideAttribs == None:\r
+                if FfsFile.OverrideAttribs is None:\r
                     EfiFileList.extend(FilePathNameList)\r
                 else:\r
                     FileName = os.path.basename(FilePathNameList[0])\r
@@ -84,7 +84,7 @@ class OPTIONROM (OptionRomClassObject):
                     BinFileList.append(TmpOutputFile)\r
             else:\r
                 FilePathName = FfsFile.GenFfs(IsMakefile=Flag)\r
-                if FfsFile.OverrideAttribs != None:\r
+                if FfsFile.OverrideAttribs is not None:\r
                     FileName = os.path.basename(FilePathName)\r
                     TmpOutputDir = os.path.join(GenFdsGlobalVariable.FvDir, self.DriverName, FfsFile.CurrentArch)\r
                     if not os.path.exists(TmpOutputDir) :\r
index c946758cf549cf7914d8af9c6d9468fb8064e5e6..e639739b7e034e4ef31f057acade8524db18363d 100644 (file)
@@ -114,7 +114,7 @@ class Region(RegionClassObject):
                     if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
                         FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
 \r
-                    if FvObj != None :\r
+                    if FvObj is not None :\r
                         if not Flag:\r
                             GenFdsGlobalVariable.InfLogger('   Region Name = FV')\r
                         #\r
@@ -152,7 +152,7 @@ class Region(RegionClassObject):
                 # Add the exist Fv image into FD buffer\r
                 #\r
                 if not Flag:\r
-                    if FileName != None:\r
+                    if FileName is not None:\r
                         FileLength = os.stat(FileName)[ST_SIZE]\r
                         if FileLength > Size:\r
                             EdkLogger.error("GenFds", GENFDS_ERROR,\r
@@ -193,7 +193,7 @@ class Region(RegionClassObject):
                     if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
                         CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]\r
 \r
-                    if CapsuleObj != None :\r
+                    if CapsuleObj is not None :\r
                         CapsuleObj.CapsuleName = RegionData.upper()\r
                         GenFdsGlobalVariable.InfLogger('   Region Name = CAPSULE')\r
                         #\r
@@ -270,7 +270,7 @@ class Region(RegionClassObject):
             #\r
             self.PadBuffer(Buffer, ErasePolarity, Size)\r
 \r
-        if self.RegionType == None:\r
+        if self.RegionType is None:\r
             GenFdsGlobalVariable.InfLogger('   Region Name = None')\r
             self.PadBuffer(Buffer, ErasePolarity, Size)\r
 \r
@@ -333,7 +333,7 @@ class Region(RegionClassObject):
             # first check whether FvObj.BlockSizeList items have only "BlockSize" or "NumBlocks",\r
             # if so, use ExpectedList\r
             for Item in FvObj.BlockSizeList:\r
-                if Item[0] == None or Item[1] == None:\r
+                if Item[0] is None or Item[1] is None:\r
                     FvObj.BlockSizeList = ExpectedList\r
                     break\r
             # make sure region size is no smaller than the summed block size in FV\r
index 463faa378165084168b42db41b413a2ac642e851..5e0b4bee7d1c509f8f81bedca7b9ee5f3786a1d6 100644 (file)
@@ -116,17 +116,17 @@ class Section (SectionClassObject):
         else :\r
             IsSect = False\r
 \r
-        if FileExtension != None:\r
+        if FileExtension is not None:\r
             Suffix = FileExtension\r
         elif IsSect :\r
             Suffix = Section.SectionType.get(FileType)\r
         else:\r
             Suffix = Section.BinFileType.get(FileType)\r
-        if FfsInf == None:\r
+        if FfsInf is None:\r
             EdkLogger.error("GenFds", GENFDS_ERROR, 'Inf File does not exist!')\r
 \r
         FileList = []\r
-        if FileType != None:\r
+        if FileType is not None:\r
             for File in FfsInf.BinFileList:\r
                 if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:\r
                     if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \\r
@@ -141,7 +141,7 @@ class Section (SectionClassObject):
                 else:\r
                     GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.File, File.Arch, FfsInf.InfFileName))\r
 \r
-        if (not IsMakefile and Suffix != None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix != None):\r
+        if (not IsMakefile and Suffix is not None and os.path.exists(FfsInf.EfiOutputPath)) or (IsMakefile and Suffix is not None):\r
             #\r
             # Get Makefile path and time stamp\r
             #\r
index 4f6926f7cae45af6b1630f443b559e0e78b732a8..6340520602eed09e7034ca1f69a12ef5e2666640 100644 (file)
@@ -52,16 +52,16 @@ class UiSection (UiSectionClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        if FfsInf != None:\r
+        if FfsInf is not None:\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
             self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
 \r
         OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))\r
 \r
-        if self.StringData != None :\r
+        if self.StringData is not None :\r
             NameString = self.StringData\r
-        elif self.FileName != None:\r
+        elif self.FileName is not None:\r
             FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
             FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r
             FileObj = open(FileNameStr, 'r')\r
index e29029980fad02db8fa36ca9014b4f0609e40fc8..11e974b9936e8435005d18841ba51cee480709e8 100644 (file)
@@ -52,7 +52,7 @@ class VerSection (VerSectionClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        if FfsInf != None:\r
+        if FfsInf is not None:\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
             self.BuildNum = FfsInf.__ExtendMacro__(self.BuildNum)\r
             self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
@@ -64,9 +64,9 @@ class VerSection (VerSectionClassObject):
 \r
         # Get String Data\r
         StringData = ''\r
-        if self.StringData != None:\r
+        if self.StringData is not None:\r
             StringData = self.StringData\r
-        elif self.FileName != None:\r
+        elif self.FileName is not None:\r
             FileNameStr = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
             FileNameStr = GenFdsGlobalVariable.MacroExtend(FileNameStr, Dict)\r
             FileObj = open(FileNameStr, 'r')\r
index 06e3d275c381da60d3520cdd2b45ccd5ebef1568..18ea37b9afdd72312e0043707165a1413e32e25c 100644 (file)
@@ -68,7 +68,7 @@ class Vtf (VtfClassObject):
         FvList = self.GetFvList()\r
         self.BsfInfName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiName + '.inf')\r
         BsfInf = open(self.BsfInfName, 'w+')\r
-        if self.ResetBin != None:\r
+        if self.ResetBin is not None:\r
             BsfInf.writelines ("[OPTIONS]" + T_CHAR_LF)\r
             BsfInf.writelines ("IA32_RST_BIN" + \\r
                                " = " + \\r
@@ -89,7 +89,7 @@ class Vtf (VtfClassObject):
                                    'N' + \\r
                                    T_CHAR_LF)\r
 \r
-            elif ComponentObj.FilePos != None:\r
+            elif ComponentObj.FilePos is not None:\r
                 BsfInf.writelines ("COMP_LOC" + \\r
                                    " = " + \\r
                                    ComponentObj.FilePos + \\r
index d30a9a2baa8bb7d71de1ae444e059b45e16c8ccd..dc2ceaf775d88c5a179930c4430ee74212aa5307 100644 (file)
@@ -73,7 +73,7 @@ def _parseForXcode(lines, efifilepath):
         if status == 1 and len(line) != 0:\r
             if '_gPcd_BinaryPatch_' in line:\r
                 m = re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_BinaryPatch_([\w]+))', line)\r
-                if m != None:\r
+                if m is not None:\r
                     pcds.append((m.groups(0)[3], int(m.groups(0)[0], 16)))\r
     return pcds\r
 \r
@@ -99,20 +99,20 @@ def _parseForGCC(lines, efifilepath):
         # 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
         if status == 3:\r
             m = re.match('^.data._gPcd_BinaryPatch_([\w_\d]+)$', line)\r
-            if m != None:\r
+            if m is not None:\r
                 if lines[index + 1]:\r
                     PcdName = m.groups(0)[0]\r
                     m = re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', lines[index + 1].strip())\r
-                    if m != None:\r
+                    if m is not None:\r
                         bpcds.append((PcdName, int(m.groups(0)[0], 16) , int(sections[-1][1], 16), sections[-1][0]))\r
                 \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 None\r
     #redirection\r
     redirection = 0\r
@@ -152,18 +152,18 @@ def _parseGeneral(lines, efifilepath):
             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
             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('^[_]+gPcd_BinaryPatch_([\w]+)', 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
@@ -173,7 +173,7 @@ def _parseGeneral(lines, efifilepath):
 \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 None\r
     \r
     pcds = []\r
@@ -214,12 +214,12 @@ if __name__ == '__main__':
   \r
     (options, args) = parser.parse_args()\r
 \r
-    if options.mapfile == None or options.efifile == None:\r
+    if options.mapfile is None or options.efifile is None:\r
         print parser.get_usage()\r
     elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):\r
         list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)\r
-        if list != None:\r
-            if options.outfile != None:\r
+        if list is not None:\r
+            if options.outfile is not None:\r
                 generatePcdTable(list, options.outfile)\r
             else:\r
                 generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))\r
index 942ba88d200f98c70ba163443aa6727140666402..0c8009cb0b44840305a50f57494da1d0963f067d 100644 (file)
@@ -267,13 +267,13 @@ def Main():
         if not os.path.exists (InputFile):\r
             EdkLogger.error("PatchPcdValue", FILE_NOT_FOUND, ExtraData=InputFile)\r
             return 1\r
-        if CommandOptions.PcdOffset == None or CommandOptions.PcdValue == None or CommandOptions.PcdTypeName == None:\r
+        if CommandOptions.PcdOffset is None or CommandOptions.PcdValue is None or CommandOptions.PcdTypeName is None:\r
             EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")\r
             return 1\r
         if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:\r
             EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))\r
             return 1\r
-        if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize == None:\r
+        if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize is None:\r
             EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")\r
             return 1\r
         #\r
index bfdf763a7abc8d1771659fec52552d0e7b0eacc8..ede9713c9b8b558be6cd995d02d064b7bc2106b4 100644 (file)
@@ -85,7 +85,7 @@ class TargetTool():
         for Key in KeyList:\r
             if type(self.TargetTxtDictionary[Key]) == type([]):\r
                 print "%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key]))\r
-            elif self.TargetTxtDictionary[Key] == None:\r
+            elif self.TargetTxtDictionary[Key] is None:\r
                 errMsg += "  Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep \r
             else:\r
                 print "%-30s = %s" % (Key, self.TargetTxtDictionary[Key])\r
@@ -116,14 +116,14 @@ class TargetTool():
                                 Line = "%-30s = \n" % Key\r
                             else:\r
                                 ret = GetConfigureKeyValue(self, Key)\r
-                                if ret != None:\r
+                                if ret is not None:\r
                                     Line = ret\r
                             fw.write(Line)\r
             for key in self.TargetTxtDictionary.keys():\r
                 if key not in existKeys:\r
                     print "Warning: %s does not exist in original configuration file" % key\r
                     Line = GetConfigureKeyValue(self, key)\r
-                    if Line == None:\r
+                    if Line is None:\r
                         Line = "%-30s = " % key\r
                     fw.write(Line)\r
                 \r
@@ -138,14 +138,14 @@ class TargetTool():
 \r
 def GetConfigureKeyValue(self, Key):\r
     Line = None\r
-    if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM and self.Opt.DSCFILE != None:\r
+    if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM and self.Opt.DSCFILE is not None:\r
         dscFullPath = os.path.join(self.WorkSpace, self.Opt.DSCFILE)\r
         if os.path.exists(dscFullPath):\r
             Line = "%-30s = %s\n" % (Key, self.Opt.DSCFILE)\r
         else:\r
             EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND, \r
                             "DSC file %s does not exist!" % self.Opt.DSCFILE, RaiseError=False)\r
-    elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.Opt.TOOL_DEFINITION_FILE != None:\r
+    elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.Opt.TOOL_DEFINITION_FILE is not None:\r
         tooldefFullPath = os.path.join(self.WorkSpace, self.Opt.TOOL_DEFINITION_FILE)\r
         if os.path.exists(tooldefFullPath):\r
             Line = "%-30s = %s\n" % (Key, self.Opt.TOOL_DEFINITION_FILE)\r
@@ -157,15 +157,15 @@ def GetConfigureKeyValue(self, Key):
         Line = "%-30s = %s\n" % (Key, 'Enable')\r
     elif self.Opt.NUM <= 1:\r
         Line = "%-30s = %s\n" % (Key, 'Disable')        \r
-    elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM != None:\r
+    elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM is not None:\r
         Line = "%-30s = %s\n" % (Key, str(self.Opt.NUM))\r
-    elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET != None:\r
+    elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET is not None:\r
         Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET))\r
-    elif Key == TAB_TAT_DEFINES_TARGET_ARCH and self.Opt.TARGET_ARCH != None:\r
+    elif Key == TAB_TAT_DEFINES_TARGET_ARCH and self.Opt.TARGET_ARCH is not None:\r
         Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET_ARCH))\r
-    elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_TAG and self.Opt.TOOL_CHAIN_TAG != None:\r
+    elif Key == TAB_TAT_DEFINES_TOOL_CHAIN_TAG and self.Opt.TOOL_CHAIN_TAG is not None:\r
         Line = "%-30s = %s\n" % (Key, self.Opt.TOOL_CHAIN_TAG)\r
-    elif Key == TAB_TAT_DEFINES_BUILD_RULE_CONF and self.Opt.BUILD_RULE_FILE != None:\r
+    elif Key == TAB_TAT_DEFINES_BUILD_RULE_CONF and self.Opt.BUILD_RULE_FILE is not None:\r
         buildruleFullPath = os.path.join(self.WorkSpace, self.Opt.BUILD_RULE_FILE)\r
         if os.path.exists(buildruleFullPath):\r
             Line = "%-30s = %s\n" % (Key, self.Opt.BUILD_RULE_FILE)\r
@@ -223,7 +223,7 @@ def MyOptionParser():
 if __name__ == '__main__':\r
     EdkLogger.Initialize()\r
     EdkLogger.SetLevel(EdkLogger.QUIET)\r
-    if os.getenv('WORKSPACE') == None:\r
+    if os.getenv('WORKSPACE') is None:\r
         print "ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool"\r
         sys.exit(1)\r
         \r
@@ -231,15 +231,15 @@ if __name__ == '__main__':
     if len(args) != 1 or (args[0].lower() != 'print' and args[0].lower() != 'clean' and args[0].lower() != 'set'):\r
         print "The number of args isn't 1 or the value of args is invalid."\r
         sys.exit(1)\r
-    if opt.NUM != None and opt.NUM < 1:\r
+    if opt.NUM is not None and opt.NUM < 1:\r
         print "The MAX_CONCURRENT_THREAD_NUMBER must be larger than 0."\r
         sys.exit(1)\r
-    if opt.TARGET != None and len(opt.TARGET) > 1:\r
+    if opt.TARGET is not None and len(opt.TARGET) > 1:\r
         for elem in opt.TARGET:\r
             if elem == '0':\r
                 print "0 will clear the TARGET setting in target.txt and can't combine with other value."\r
                 sys.exit(1)\r
-    if opt.TARGET_ARCH != None and len(opt.TARGET_ARCH) > 1:\r
+    if opt.TARGET_ARCH is not None and len(opt.TARGET_ARCH) > 1:\r
         for elem in opt.TARGET_ARCH:\r
             if elem == '0':\r
                 print "0 will clear the TARGET_ARCH setting in target.txt and can't combine with other value."\r
index d1e40b025caa0f3f0b86068caea5e626e2f10734..d07edbd5d8722ff7783a6c6c42e4182d622d687e 100644 (file)
@@ -173,7 +173,7 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
         elif PreprocessedFile == "" or InjectedFile != PreprocessedFile:\r
             continue\r
 \r
-        if LineIndexOfOriginalFile == None:\r
+        if LineIndexOfOriginalFile is None:\r
             #\r
             # Any non-empty lines must be from original preprocessed file.\r
             # And this must be the first one.\r
@@ -193,7 +193,7 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
         # convert Decimal number format\r
         Line = gDecNumberPattern.sub(r"\1", Line)\r
 \r
-        if LineNumber != None:\r
+        if LineNumber is not None:\r
             EdkLogger.verbose("Got line directive: line=%d" % LineNumber)\r
             # in case preprocessor removed some lines, like blank or comment lines\r
             if LineNumber <= len(NewLines):\r
@@ -216,10 +216,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
         Brace = 0\r
         for Index in range(len(Lines)):\r
             Line = Lines[Index]\r
-            if MulPatternFlag == False and gTypedef_MulPattern.search(Line) == None:\r
-                if SinglePatternFlag == False and gTypedef_SinglePattern.search(Line) == None:\r
+            if MulPatternFlag == False and gTypedef_MulPattern.search(Line) is None:\r
+                if SinglePatternFlag == False and gTypedef_SinglePattern.search(Line) is None:\r
                     # remove "#pragram pack" directive\r
-                    if gPragmaPattern.search(Line) == None:\r
+                    if gPragmaPattern.search(Line) is None:\r
                         NewLines.append(Line)\r
                     continue\r
                 elif SinglePatternFlag == False:\r
@@ -282,9 +282,9 @@ def TrimPreprocessedVfr(Source, Target):
             Lines[Index] = "\n"\r
             continue\r
 \r
-        if FoundTypedef == False and gTypedefPattern.search(Line) == None:\r
+        if FoundTypedef == False and gTypedefPattern.search(Line) is None:\r
             # keep "#pragram pack" directive\r
-            if gPragmaPattern.search(Line) == None:\r
+            if gPragmaPattern.search(Line) is None:\r
                 Lines[Index] = "\n"\r
             continue\r
         elif FoundTypedef == False:\r
@@ -510,7 +510,7 @@ def TrimEdkSources(Source, Target):
             for FileName in Files:\r
                 Dummy, Ext = os.path.splitext(FileName)\r
                 if Ext.upper() not in ['.C', '.H']: continue\r
-                if Target == None or Target == '':\r
+                if Target is None or Target == '':\r
                     TrimEdkSourceCode(\r
                         os.path.join(CurrentDir, FileName),\r
                         os.path.join(CurrentDir, FileName)\r
@@ -568,7 +568,7 @@ def TrimEdkSourceCode(Source, Target):
 \r
     NewLines = None\r
     for Re,Repl in gImportCodePatterns:\r
-        if NewLines == None:\r
+        if NewLines is None:\r
             NewLines = Re.sub(Repl, Lines)\r
         else:\r
             NewLines = Re.sub(Repl, NewLines)\r
@@ -672,11 +672,11 @@ def Main():
     \r
     try:\r
         if CommandOptions.FileType == "Vfr":\r
-            if CommandOptions.OutputFile == None:\r
+            if CommandOptions.OutputFile is None:\r
                 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'\r
             TrimPreprocessedVfr(InputFile, CommandOptions.OutputFile)\r
         elif CommandOptions.FileType == "Asl":\r
-            if CommandOptions.OutputFile == None:\r
+            if CommandOptions.OutputFile is None:\r
                 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'\r
             TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile)\r
         elif CommandOptions.FileType == "EdkSourceCode":\r
@@ -684,13 +684,13 @@ def Main():
         elif CommandOptions.FileType == "VfrOffsetBin":\r
             GenerateVfrBinSec(CommandOptions.ModuleName, CommandOptions.DebugDir, CommandOptions.OutputFile)\r
         else :\r
-            if CommandOptions.OutputFile == None:\r
+            if CommandOptions.OutputFile is None:\r
                 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'\r
             TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong)\r
     except FatalError, X:\r
         import platform\r
         import traceback\r
-        if CommandOptions != None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9:\r
+        if CommandOptions is not None and CommandOptions.LogLevel <= EdkLogger.DEBUG_9:\r
             EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
         return 1\r
     except:\r
index 26c5a97da80fc16ca60eb8b7794b8fbf28093b92..2af847ed2e0bbcfaa28d59aa83891608ad24d423 100644 (file)
@@ -104,12 +104,12 @@ class DependencyRules(object):
             # check whether satisfied by current distribution \r
             #\r
             if not Exist:\r
-                if DpObj == None:\r
+                if DpObj is None:\r
                     Result = False\r
                     break\r
                 for GuidVerPair in DpObj.PackageSurfaceArea.keys():\r
                     if Dep.GetGuid() == GuidVerPair[0]:\r
-                        if Dep.GetVersion() == None or \\r
+                        if Dep.GetVersion() is None or \\r
                         len(Dep.GetVersion()) == 0:\r
                             Result = True\r
                             break\r
index f147963288adcdfc1746cd1d955eb8d5d29ef04d..78d67ab31e1eaba543cb9ee1f6199b07fab9283e 100644 (file)
@@ -247,13 +247,13 @@ class IpiDatabase(object):
     def _AddDp(self, Guid, Version, NewDpFileName, DistributionFileName, \\r
                RePackage):\r
         \r
-        if Version == None or len(Version.strip()) == 0:\r
+        if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
         \r
         #\r
         # Add newly installed DP information to DB.\r
         #\r
-        if NewDpFileName == None or len(NewDpFileName.strip()) == 0:\r
+        if NewDpFileName is None or len(NewDpFileName.strip()) == 0:\r
             PkgFileName = 'N/A'\r
         else:\r
             PkgFileName = NewDpFileName\r
@@ -295,13 +295,13 @@ class IpiDatabase(object):
     #\r
     def _AddPackage(self, Guid, Version, DpGuid=None, DpVersion=None, Path=''):\r
         \r
-        if Version == None or len(Version.strip()) == 0:\r
+        if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
         \r
-        if DpGuid == None or len(DpGuid.strip()) == 0:\r
+        if DpGuid is None or len(DpGuid.strip()) == 0:\r
             DpGuid = 'N/A'\r
         \r
-        if DpVersion == None or len(DpVersion.strip()) == 0:\r
+        if DpVersion is None or len(DpVersion.strip()) == 0:\r
             DpVersion = 'N/A'\r
         \r
         #\r
@@ -325,13 +325,13 @@ class IpiDatabase(object):
     def _AddModuleInPackage(self, Guid, Version, Name, PkgGuid=None, \\r
                             PkgVersion=None, Path=''):\r
         \r
-        if Version == None or len(Version.strip()) == 0:\r
+        if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
         \r
-        if PkgGuid == None or len(PkgGuid.strip()) == 0:\r
+        if PkgGuid is None or len(PkgGuid.strip()) == 0:\r
             PkgGuid = 'N/A'\r
         \r
-        if PkgVersion == None or len(PkgVersion.strip()) == 0:\r
+        if PkgVersion is None or len(PkgVersion.strip()) == 0:\r
             PkgVersion = 'N/A'\r
             \r
         if os.name == 'posix':\r
@@ -361,13 +361,13 @@ class IpiDatabase(object):
     def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \\r
                              DpVersion=None, Path=''):\r
         \r
-        if Version == None or len(Version.strip()) == 0:\r
+        if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
         \r
-        if DpGuid == None or len(DpGuid.strip()) == 0:\r
+        if DpGuid is None or len(DpGuid.strip()) == 0:\r
             DpGuid = 'N/A'\r
         \r
-        if DpVersion == None or len(DpVersion.strip()) == 0:\r
+        if DpVersion is None or len(DpVersion.strip()) == 0:\r
             DpVersion = 'N/A'\r
         \r
         #\r
@@ -391,10 +391,10 @@ class IpiDatabase(object):
     def _AddModuleDepex(self, Guid, Version, Name, Path, DepexGuid=None, \\r
                         DepexVersion=None):\r
                 \r
-        if DepexGuid == None or len(DepexGuid.strip()) == 0:\r
+        if DepexGuid is None or len(DepexGuid.strip()) == 0:\r
             DepexGuid = 'N/A'\r
         \r
-        if DepexVersion == None or len(DepexVersion.strip()) == 0:\r
+        if DepexVersion is None or len(DepexVersion.strip()) == 0:\r
             DepexVersion = 'N/A'\r
             \r
         if os.name == 'posix':\r
@@ -510,7 +510,7 @@ class IpiDatabase(object):
     #\r
     def GetDp(self, Guid, Version):\r
         \r
-        if Version == None or len(Version.strip()) == 0:\r
+        if Version is None or len(Version.strip()) == 0:\r
             Version = 'N/A'\r
             Logger.Verbose(ST.MSG_GET_DP_INSTALL_LIST)\r
             (DpGuid, DpVersion) = (Guid, Version)\r
@@ -642,7 +642,7 @@ class IpiDatabase(object):
                                             PackageVersion)\r
             self.Cur.execute(SqlCommand)\r
         \r
-        elif Version == None or len(Version.strip()) == 0:\r
+        elif Version is None or len(Version.strip()) == 0:\r
             \r
             SqlCommand = """select * from %s where PackageGuid ='%s'""" % \\r
             (self.PkgTable, Guid)\r
index 5fafd85bffbf5107a721b5c9b1913b9d0242a45e..ec6f5503eaad39756894c329f87432e763d17475 100644 (file)
@@ -56,7 +56,7 @@ class PackageFile:
                             ExtraData="%s (%s)" % (FileName, str(Xstr)))\r
 \r
         BadFile = self._ZipFile.testzip()\r
-        if BadFile != None:\r
+        if BadFile is not None:\r
             Logger.Error("PackagingTool", FILE_CHECKSUM_FAILURE, \r
                             ExtraData="[%s] in %s" % (BadFile, FileName))\r
     \r
index d7eaf3ea1d12d1bd210110970114c923d58b51ef..9373a144190d2126744376c88bef06ede2eae23f 100644 (file)
@@ -618,11 +618,11 @@ def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
     # format of SourceFile|Family|TagName|ToolCode|FeatureFlag\r
     #\r
     Statement += SourceFile\r
-    if TagName == None:\r
+    if TagName is None:\r
         TagName = ''\r
-    if ToolCode == None:\r
+    if ToolCode is None:\r
         ToolCode = ''\r
-    if HelpStr == None:\r
+    if HelpStr is None:\r
         HelpStr = ''\r
     if FeatureFlag:\r
         Statement += '|' + Family + '|' + TagName + '|' + ToolCode + '|' + FeatureFlag\r
index a8d0e1ec440a8bcfd05ed157560cafe6cc060c6e..c0d56b55aacde53df33d0ea1c6add11317aac3a2 100644 (file)
@@ -91,7 +91,7 @@ def InstallNewPackage(WorkspaceDir, Path, CustomPath = False):
 # @param PathList:       The already installed standalone module Path list\r
 #\r
 def InstallNewModule(WorkspaceDir, Path, PathList = None):\r
-    if PathList == None:\r
+    if PathList is None:\r
         PathList = []\r
     Path = ConvertPath(Path)\r
     Path = os.path.normpath(Path)\r
index e6d45103f94be2902354d01eac32b5210b316961..38f7012fd4f8f823325004a8a64c411220299e30 100644 (file)
@@ -555,15 +555,15 @@ def ParseComment (Comment, UsageTokens, TypeTokens, RemoveTokens, ParseVariable)
     # from HelpText\r
     #\r
     for Token in List[0:NumTokens]:\r
-        if Usage == None and Token in UsageTokens:\r
+        if Usage is None and Token in UsageTokens:\r
             Usage = UsageTokens[Token]\r
             HelpText = HelpText.replace(Token, '')\r
-    if Usage != None or not ParseVariable:\r
+    if Usage is not None or not ParseVariable:\r
         for Token in List[0:NumTokens]:\r
-            if Type == None and Token in TypeTokens:\r
+            if Type is None and Token in TypeTokens:\r
                 Type = TypeTokens[Token]\r
                 HelpText = HelpText.replace(Token, '')\r
-            if Usage != None:    \r
+            if Usage is not None:    \r
                 for Token in List[0:NumTokens]:\r
                     if Token in RemoveTokens:\r
                         HelpText = HelpText.replace(Token, '')\r
@@ -571,13 +571,13 @@ def ParseComment (Comment, UsageTokens, TypeTokens, RemoveTokens, ParseVariable)
     #\r
     # If no Usage token is present and set Usage to UNDEFINED\r
     #  \r
-    if Usage == None:\r
+    if Usage is None:\r
         Usage = 'UNDEFINED'\r
     \r
     #\r
     # If no Type token is present and set Type to UNDEFINED\r
     #  \r
-    if Type == None:\r
+    if Type is None:\r
         Type = 'UNDEFINED'\r
     \r
     #\r
index 0d92cb3767c65482335b13a140890d3e13874167..719445b3bd9ab0b2c69b66310cc6d8b759fb1f29 100644 (file)
@@ -120,7 +120,7 @@ def GuidStructureStringToGuidString(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 access(Directory, F_OK):\r
@@ -134,7 +134,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 \\r
+    if Directory is None or Directory.strip() == "" or not \\r
     os.path.exists(Directory):\r
         return\r
     if Recursively:\r
@@ -237,7 +237,7 @@ def GetNonMetaDataFiles(Root, SkipList, FullPath, PrefixPath):
 #\r
 def ValidFile(File, Ext=None):\r
     File = File.replace('\\', '/')\r
-    if Ext != None:\r
+    if Ext is not None:\r
         FileExt = os.path.splitext(File)[1]\r
         if FileExt.lower() != Ext.lower():\r
             return False\r
@@ -423,7 +423,7 @@ class Sdict(IterableUserDict):
     ## update method\r
     #\r
     def update(self, Dict=None, **Kwargs):\r
-        if Dict != None:\r
+        if Dict is not None:\r
             for Key1, Val1 in Dict.items():\r
                 self[Key1] = Val1\r
         if len(Kwargs):\r
@@ -529,7 +529,7 @@ class PathClass(object):
     ## _GetFileKey\r
     #\r
     def _GetFileKey(self):\r
-        if self._Key == None:\r
+        if self._Key is None:\r
             self._Key = self.Path.upper()\r
         return self._Key\r
     ## Validate\r
index 028cf9a54f84cc569397ab5bd590a96653618129..2def90a93b5132712bb99c25b729af563ecc2815 100644 (file)
@@ -128,7 +128,7 @@ def IsValidInfComponentType(ComponentType):
 #\r
 def IsValidToolFamily(ToolFamily):\r
     ReIsValieFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)\r
-    if ReIsValieFamily.match(ToolFamily) == None:\r
+    if ReIsValieFamily.match(ToolFamily) is None:\r
         return False\r
     return True\r
 \r
@@ -159,7 +159,7 @@ def IsValidArch(Arch):
     if Arch == 'common':\r
         return True\r
     ReIsValieArch = re.compile(r"^[a-zA-Z]+[a-zA-Z0-9]{0,}$", re.DOTALL)\r
-    if ReIsValieArch.match(Arch) == None:\r
+    if ReIsValieArch.match(Arch) is None:\r
         return False\r
     return True\r
 \r
@@ -179,7 +179,7 @@ def IsValidFamily(Family):
         return True\r
        \r
     ReIsValidFamily = re.compile(r"^[A-Z]+[A-Za-z0-9]{0,}$", re.DOTALL)\r
-    if ReIsValidFamily.match(Family) == None:\r
+    if ReIsValidFamily.match(Family) is None:\r
         return False\r
     return True\r
 \r
@@ -199,13 +199,13 @@ def IsValidBuildOptionName(BuildOptionName):
     ReIsValidBuildOption1 = re.compile(r"^\s*(\*)|([A-Z][a-zA-Z0-9]*)$")\r
     ReIsValidBuildOption2 = re.compile(r"^\s*(\*)|([a-zA-Z][a-zA-Z0-9]*)$")\r
     \r
-    if ReIsValidBuildOption1.match(ToolOptionList[0]) == None:\r
+    if ReIsValidBuildOption1.match(ToolOptionList[0]) is None:\r
         return False\r
     \r
-    if ReIsValidBuildOption1.match(ToolOptionList[1]) == None:\r
+    if ReIsValidBuildOption1.match(ToolOptionList[1]) is None:\r
         return False\r
     \r
-    if ReIsValidBuildOption2.match(ToolOptionList[2]) == None:\r
+    if ReIsValidBuildOption2.match(ToolOptionList[2]) is None:\r
         return False\r
     \r
     if ToolOptionList[3] == "*" and ToolOptionList[4] not in ['FAMILY', 'DLL', 'DPATH']:\r
@@ -442,7 +442,7 @@ def IsValidDecVersion(Word):
         ReIsValidDecVersion = re.compile(r"[0-9]+\.?[0-9]+$")\r
     else:\r
         ReIsValidDecVersion = re.compile(r"[0-9]+$")\r
-    if ReIsValidDecVersion.match(Word) == None:\r
+    if ReIsValidDecVersion.match(Word) is None:\r
         return False \r
     return True\r
    \r
@@ -457,7 +457,7 @@ def IsValidDecVersion(Word):
 #  \r
 def IsValidHexVersion(Word):\r
     ReIsValidHexVersion = re.compile(r"[0][xX][0-9A-Fa-f]{8}$", re.DOTALL)\r
-    if ReIsValidHexVersion.match(Word) == None:\r
+    if ReIsValidHexVersion.match(Word) is None:\r
         return False\r
     \r
     return True\r
@@ -471,7 +471,7 @@ def IsValidHexVersion(Word):
 #  \r
 def IsValidBuildNumber(Word):\r
     ReIsValieBuildNumber = re.compile(r"[0-9]{1,4}$", re.DOTALL)\r
-    if ReIsValieBuildNumber.match(Word) == None:\r
+    if ReIsValieBuildNumber.match(Word) is None:\r
         return False\r
     \r
     return True\r
@@ -488,7 +488,7 @@ def IsValidDepex(Word):
         return IsValidCFormatGuid(Word[Index+4:].strip())\r
 \r
     ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_\s\.]*$", re.DOTALL)\r
-    if ReIsValidCName.match(Word) == None:\r
+    if ReIsValidCName.match(Word) is None:\r
         return False\r
     \r
     return True\r
@@ -585,11 +585,11 @@ def IsValidPcdValue(PcdValue):
         return True\r
     \r
     ReIsValidIntegerSingle = re.compile(r"^\s*[0-9]\s*$", re.DOTALL)\r
-    if ReIsValidIntegerSingle.match(PcdValue) != None:\r
+    if ReIsValidIntegerSingle.match(PcdValue) is not None:\r
         return True\r
     \r
     ReIsValidIntegerMulti = re.compile(r"^\s*[1-9][0-9]+\s*$", re.DOTALL)   \r
-    if ReIsValidIntegerMulti.match(PcdValue) != None:\r
+    if ReIsValidIntegerMulti.match(PcdValue) is not None:\r
         return True\r
     \r
     #\r
@@ -654,7 +654,7 @@ def IsValidPcdValue(PcdValue):
 #     \r
 def IsValidCVariableName(CName):\r
     ReIsValidCName = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)\r
-    if ReIsValidCName.match(CName) == None:\r
+    if ReIsValidCName.match(CName) is None:\r
         return False\r
     \r
     return True\r
@@ -669,7 +669,7 @@ def IsValidCVariableName(CName):
 #\r
 def IsValidIdentifier(Ident):\r
     ReIdent = re.compile(r"^[A-Za-z_][0-9A-Za-z_]*$", re.DOTALL)\r
-    if ReIdent.match(Ident) == None:\r
+    if ReIdent.match(Ident) is None:\r
         return False\r
     \r
     return True\r
@@ -683,7 +683,7 @@ def IsValidIdentifier(Ident):
 def IsValidDecVersionVal(Ver):\r
     ReVersion = re.compile(r"[0-9]+(\.[0-9]{1,2})$")\r
     \r
-    if ReVersion.match(Ver) == None:\r
+    if ReVersion.match(Ver) is None:\r
         return False\r
       \r
     return True\r
index c34e7751442ab542ac14c52e1fde7e788d7d109c..791e064761c06ae6f8671fd80d0c3301347fc569 100644 (file)
@@ -134,7 +134,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, DataType.TAB_SPLIT)\r
         if len(TokenInfoList) == 2:\r
             return True\r
@@ -433,7 +433,7 @@ def GetComponents(Lines, 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
@@ -921,7 +921,7 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
         FileLocalMacros[Name] = Value\r
 \r
     ReIsValidMacroName = re.compile(r"^[A-Z][A-Z0-9_]*$", re.DOTALL)\r
-    if ReIsValidMacroName.match(Name) == None:\r
+    if ReIsValidMacroName.match(Name) is None:\r
         Logger.Error('Parser',\r
                      FORMAT_INVALID,\r
                      ST.ERR_MACRONAME_INVALID % (Name),\r
@@ -940,7 +940,7 @@ def MacroParser(Line, FileName, SectionType, FileLocalMacros):
     # <UnicodeString>, <CArray> are subset of <AsciiString>.\r
     #\r
     ReIsValidMacroValue = re.compile(r"^[\x20-\x7e]*$", re.DOTALL)\r
-    if ReIsValidMacroValue.match(Value) == None:\r
+    if ReIsValidMacroValue.match(Value) is None:\r
         Logger.Error('Parser',\r
                      FORMAT_INVALID,\r
                      ST.ERR_MACROVALUE_INVALID % (Value),\r
@@ -979,7 +979,7 @@ def GenSection(SectionName, SectionDict, SplitArch=True, NeedBlankLine=False):
         else:\r
             Section = '[' + SectionName + ']'\r
         Content += '\n' + Section + '\n'\r
-        if StatementList != None:\r
+        if StatementList is not None:\r
             for Statement in StatementList:\r
                 LineList = Statement.split('\n')\r
                 NewStatement = ""\r
index 278073e4a379786ba26c5f1b832bec32f1fb7049..b79891ea1417452d40c666f582a4bfbea523c179 100644 (file)
@@ -166,7 +166,7 @@ def SplitModuleType(Key):
 #\r
 def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None, FileName=None, Flag=False):\r
     LastString = String\r
-    if MacroDefinitions == None:\r
+    if MacroDefinitions is None:\r
         MacroDefinitions = {}\r
     while MacroDefinitions:\r
         QuotedStringList = []\r
@@ -244,7 +244,7 @@ def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None
 #\r
 def NormPath(Path, Defines=None):\r
     IsRelativePath = False\r
-    if Defines == None:\r
+    if Defines is None:\r
         Defines = {}\r
     if Path:\r
         if Path[0] == '.':\r
@@ -524,7 +524,7 @@ def PreCheck(FileName, FileContent, SupSectionTag):
 #                            to be checked\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() and Root:\r
             ContainerFile = open(ContainerFilename, 'r').read()\r
@@ -552,7 +552,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 0014a7561ba88b1b02b735ecc04ba2b334571f0c..66eefee9db31041aa2a92cfa6ebc74bc2ef6afef 100644 (file)
@@ -161,7 +161,7 @@ def GetLanguageCode1766(LangName, File=None):
             for Key in gLANG_CONV_TABLE.keys():\r
                 if gLANG_CONV_TABLE.get(Key) == LangName[0:2].lower():\r
                     return Key\r
-        if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) == None and LangName[3] == '-':\r
+        if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':\r
             for Key in gLANG_CONV_TABLE.keys():\r
                 if Key == LangName[0:3].lower():\r
                     return Key\r
@@ -186,7 +186,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
     if IsCompatibleMode:\r
         if length == 3 and LangName.isalpha():\r
             TempLangName = gLANG_CONV_TABLE.get(LangName.lower())\r
-            if TempLangName != None:\r
+            if TempLangName is not None:\r
                 return TempLangName\r
             return LangName\r
         else:\r
@@ -200,7 +200,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
         if LangName.isalpha():\r
             return LangName\r
     elif length == 3:\r
-        if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) == None:\r
+        if LangName.isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None:\r
             return LangName\r
     elif length == 5:\r
         if LangName[0:2].isalpha() and LangName[2] == '-':\r
@@ -208,7 +208,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 gLANG_CONV_TABLE.get(LangName.lower()) == None and LangName[3] == '-':\r
+        if LangName[0:3].isalpha() and gLANG_CONV_TABLE.get(LangName.lower()) is None and LangName[3] == '-':\r
             return LangName\r
 \r
     EdkLogger.Error("Unicode File Parser", \r
@@ -270,14 +270,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\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
@@ -288,7 +288,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
             if self.StringValue:\r
                 self.StringValue = self.StringValue + '\r\n' + Value\r
             else:\r
@@ -393,7 +393,7 @@ class UniFileClassObject(object):
         # Check the string name is the upper character\r
         if Name != '':\r
             MatchString = re.match('[A-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", \r
                              ToolError.FORMAT_INVALID,\r
                              'The string token name %s in UNI file %s must be upper case character.' %(Name, self.File))\r
@@ -798,7 +798,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", \r
                             ToolError.PARSER_ERROR, \r
                             Message='No unicode file is given', \r
@@ -901,7 +901,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 d7614b884990248fd52cbf5e67f9fefbdf447425..f20ae4dfa82f24acba91f1f3de06c899aa358aea 100644 (file)
@@ -36,14 +36,14 @@ import Logger.Log as Logger
 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
@@ -52,7 +52,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
@@ -66,7 +66,7 @@ def CreateXmlElement(Name, String, NodeList, AttributeList):
 # @param  String             A XPath style path.\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
@@ -101,7 +101,7 @@ def XmlList(Dom, String):
 # @param  String             A XPath style path.\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 None\r
     if Dom.nodeType == Dom.DOCUMENT_NODE:\r
         Dom = Dom.documentElement\r
index 407a1b32b6eeb8f653d90623e6c834831d83d081..ae06a1ae2a503c5836d1eea3caeb17b1c5d1795d 100644 (file)
@@ -134,7 +134,7 @@ def Debug(Level, Message, ExtraData=None):
         "msg"       : Message,\r
     }\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict + "\n    %s" % ExtraData\r
     else:\r
         LogText = _DEBUG_MESSAGE_TEMPLATE % TemplateDict\r
@@ -165,10 +165,10 @@ def Warn(ToolName, Message, File=None, Line=None, ExtraData=None):
     #\r
     # if no tool name given, use caller's source file name as tool name\r
     #\r
-    if ToolName == None or ToolName == "":\r
+    if ToolName is None or ToolName == "":\r
         ToolName = os.path.basename(extract_stack()[-2][0])\r
 \r
-    if Line == None:\r
+    if Line is None:\r
         Line = "..."\r
     else:\r
         Line = "%d" % Line\r
@@ -180,12 +180,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 = _WARNING_MESSAGE_TEMPLATE % TemplateDict\r
     else:\r
         LogText = _WARNING_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict\r
 \r
-    if ExtraData != None:\r
+    if ExtraData is not None:\r
         LogText += "\n    %s" % ExtraData\r
 \r
     _INFO_LOGGER.log(WARN, LogText)\r
@@ -215,18 +215,18 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
           ExtraData=None, RaiseError=IS_RAISE_ERROR):\r
     if ToolName:\r
         pass\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 gERROR_MESSAGE:\r
             Message = gERROR_MESSAGE[ErrorCode]\r
         else:\r
             Message = gERROR_MESSAGE[UNKNOWN_ERROR]\r
 \r
-    if ExtraData == None:\r
+    if ExtraData is None:\r
         ExtraData = ""\r
 \r
     TemplateDict = {\r
@@ -238,7 +238,7 @@ def Error(ToolName, ErrorCode, Message=None, File=None, Line=None, \
         "extra"     : ExtraData\r
     }\r
 \r
-    if File != None:\r
+    if File is not None:\r
         LogText =  _ERROR_MESSAGE_TEMPLATE % TemplateDict\r
     else:\r
         LogText = __ERROR_MESSAGE_TEMPLATE_WITHOUT_FILE % TemplateDict\r
index 87c84f0cc25b6fb0c8edf59ab809557153b2c11b..ff9aa7fb117c8d5bc4fdb89cec478dc43311b060 100644 (file)
@@ -73,7 +73,7 @@ def CheckForExistingDp(Path):
 #\r
 #\r
 def Main(Options = None):\r
-    if Options == None:\r
+    if Options is None:\r
         Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)\r
     try:\r
         DataBase = GlobalData.gDB        \r
index f968beee6081ee601e67ebb5084a385fb060aab6..33b142d64e077c70176eeb9c10be99f3b63ca448 100644 (file)
@@ -271,7 +271,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                 #\r
                                 pass\r
 \r
-            if InfBianryVerItemObj != None:\r
+            if InfBianryVerItemObj is not None:\r
                 if self.Binaries.has_key((InfBianryVerItemObj)):\r
                     BinariesList = self.Binaries[InfBianryVerItemObj]\r
                     BinariesList.append((InfBianryVerItemObj, VerComment))\r
@@ -521,7 +521,7 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                #\r
 #                                pass\r
 \r
-            if InfBianryCommonItemObj != None:\r
+            if InfBianryCommonItemObj is not None:\r
                 if self.Binaries.has_key((InfBianryCommonItemObj)):\r
                     BinariesList = self.Binaries[InfBianryCommonItemObj]\r
                     BinariesList.append((InfBianryCommonItemObj, ItemComment))\r
@@ -538,11 +538,11 @@ class InfBinariesObject(InfSectionCommonDef):
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'\r
             __SupArchList.append(ArchItem)\r
 \r
-        if UiInf != None:\r
+        if UiInf is not None:\r
             if len(UiInf) > 0:\r
                 #\r
                 # Check UI\r
@@ -672,7 +672,7 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                        #\r
 #                                        pass\r
 \r
-                    if InfBianryUiItemObj != None:\r
+                    if InfBianryUiItemObj is not None:\r
                         if self.Binaries.has_key((InfBianryUiItemObj)):\r
                             BinariesList = self.Binaries[InfBianryUiItemObj]\r
                             BinariesList.append((InfBianryUiItemObj, UiComment))\r
@@ -681,7 +681,7 @@ class InfBinariesObject(InfSectionCommonDef):
                             BinariesList = []\r
                             BinariesList.append((InfBianryUiItemObj, UiComment))\r
                             self.Binaries[InfBianryUiItemObj] = BinariesList\r
-        if Ver != None and len(Ver) > 0:\r
+        if Ver is not None and len(Ver) > 0:\r
             self.CheckVer(Ver, __SupArchList)\r
         if CommonBinary and len(CommonBinary) > 0:\r
             self.ParseCommonBinary(CommonBinary, __SupArchList)\r
index 1d074ee638fdfb8da5928c08db65c7959715bf95..bbc797f65e3783ef0977c4172a3d0ddb263aca6f 100644 (file)
@@ -62,7 +62,7 @@ class InfDefSectionOptionRomInfo():
         #\r
         # Value has been set before.\r
         #\r
-        if self.PciVendorId != None:\r
+        if self.PciVendorId is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_VENDOR_ID),\r
                        LineInfo=self.CurrentLine)\r
             return False           \r
@@ -86,7 +86,7 @@ class InfDefSectionOptionRomInfo():
         #\r
         # Value has been set before.\r
         #\r
-        if self.PciDeviceId != None:\r
+        if self.PciDeviceId is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_DEVICE_ID),\r
                        LineInfo=self.CurrentLine)\r
             return False         \r
@@ -110,7 +110,7 @@ class InfDefSectionOptionRomInfo():
         #\r
         # Value has been set before.\r
         #\r
-        if self.PciClassCode != None:\r
+        if self.PciClassCode is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_CLASS_CODE),\r
                        LineInfo=self.CurrentLine)\r
             return False        \r
@@ -135,7 +135,7 @@ class InfDefSectionOptionRomInfo():
         #\r
         # Value has been set before.\r
         #\r
-        if self.PciRevision != None:\r
+        if self.PciRevision is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_REVISION),\r
                        LineInfo=self.CurrentLine)\r
             return False          \r
@@ -159,7 +159,7 @@ class InfDefSectionOptionRomInfo():
         #\r
         # Value has been set before.\r
         #\r
-        if self.PciCompress != None:\r
+        if self.PciCompress is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_COMPRESS),\r
                        LineInfo=self.CurrentLine)\r
             return False\r
@@ -215,11 +215,11 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.BaseName != None:    \r
+        if self.BaseName is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_BASE_NAME),\r
                        LineInfo=self.CurrentLine)\r
             return False     \r
-        if not (BaseName == '' or BaseName == None):\r
+        if not (BaseName == '' or BaseName is None):\r
             if IsValidWord(BaseName) and not BaseName.startswith("_"):\r
                 self.BaseName = InfDefMember()\r
                 self.BaseName.SetValue(BaseName)\r
@@ -243,7 +243,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.FileGuid != None:    \r
+        if self.FileGuid is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_FILE_GUID),\r
                        LineInfo=self.CurrentLine)\r
@@ -274,7 +274,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.ModuleType != None:    \r
+        if self.ModuleType is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_MODULE_TYPE),\r
                        LineInfo=self.CurrentLine)\r
@@ -309,7 +309,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
     def SetModuleUniFileName(self, ModuleUniFileName, Comments):\r
         if Comments:\r
             pass\r
-        if self.ModuleUniFileName != None:\r
+        if self.ModuleUniFileName is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_MODULE_UNI_FILE),\r
                        LineInfo=self.CurrentLine)\r
         self.ModuleUniFileName = ModuleUniFileName\r
@@ -327,7 +327,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.InfVersion != None:    \r
+        if self.InfVersion is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_INF_VERSION),\r
                        LineInfo=self.CurrentLine)\r
@@ -368,7 +368,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.EdkReleaseVersion != None:    \r
+        if self.EdkReleaseVersion is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION),\r
                        LineInfo=self.CurrentLine)\r
@@ -401,7 +401,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.UefiSpecificationVersion != None:    \r
+        if self.UefiSpecificationVersion is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION),\r
                        LineInfo=self.CurrentLine)\r
@@ -434,7 +434,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.PiSpecificationVersion != None:    \r
+        if self.PiSpecificationVersion is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION),\r
                        LineInfo=self.CurrentLine)\r
@@ -495,7 +495,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.VersionString != None:    \r
+        if self.VersionString is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_VERSION_STRING),\r
                        LineInfo=self.CurrentLine)\r
@@ -517,7 +517,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.PcdIsDriver != None:    \r
+        if self.PcdIsDriver is not None:    \r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\\r
                        %(DT.TAB_INF_DEFINES_PCD_IS_DRIVER),\r
                        LineInfo=self.CurrentLine)\r
@@ -710,7 +710,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.Shadow != None:\r
+        if self.Shadow is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_SHADOW),\r
                        LineInfo=self.CurrentLine)\r
             return False          \r
@@ -731,7 +731,7 @@ class InfDefSection(InfDefSectionOptionRomInfo):
     # <CustomMake>           ::=  [<Family> "|"] <Filename>\r
     #\r
     def SetCustomMakefile(self, CustomMakefile, Comments):\r
-        if not (CustomMakefile == '' or CustomMakefile == None):\r
+        if not (CustomMakefile == '' or CustomMakefile is None):\r
             ValueList = GetSplitValueList(CustomMakefile)\r
             if len(ValueList) == 1:\r
                 FileName = ValueList[0]\r
@@ -811,12 +811,12 @@ class InfDefSection(InfDefSectionOptionRomInfo):
         #\r
         # Value has been set before.\r
         #\r
-        if self.UefiHiiResourceSection != None:\r
+        if self.UefiHiiResourceSection is not None:\r
             ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\r
                        %(DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION),\r
                        LineInfo=self.CurrentLine)\r
             return False           \r
-        if not (UefiHiiResourceSection == '' or UefiHiiResourceSection == None):\r
+        if not (UefiHiiResourceSection == '' or UefiHiiResourceSection is None):\r
             if (IsValidBoolType(UefiHiiResourceSection)):\r
                 self.UefiHiiResourceSection = InfDefMember()\r
                 self.UefiHiiResourceSection.SetValue(UefiHiiResourceSection)\r
@@ -948,7 +948,7 @@ class InfDefObject(InfSectionCommonDef):
                            RaiseError=True)\r
             if Name == DT.TAB_INF_DEFINES_INF_VERSION:\r
                 HasFoundInfVersionFalg = True  \r
-            if not (Name == '' or Name == None):\r
+            if not (Name == '' or Name is None):\r
                 #\r
                 # Process "SPEC" Keyword definition.\r
                 #\r
@@ -971,7 +971,7 @@ class InfDefObject(InfSectionCommonDef):
                                    LineInfo=LineInfo)                           \r
                     else:\r
                         ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]\r
-                    if (ProcessFunc != None):\r
+                    if (ProcessFunc is not None):\r
                         ProcessFunc(DefineList, Value, InfLineCommentObj)\r
                     self.Defines[ArchListString] = DefineList\r
                 else:\r
@@ -991,7 +991,7 @@ class InfDefObject(InfSectionCommonDef):
                     #                    \r
                     else:\r
                         ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[Name]\r
-                    if (ProcessFunc != None):\r
+                    if (ProcessFunc is not None):\r
                         ProcessFunc(DefineList, Value, InfLineCommentObj)\r
                     self.Defines[ArchListString] = DefineList\r
         #\r
index 23125552e06d025ab0270ac1550913192e506b63..fb8d1f5a62eeabe626e934a6bbdf93afd3b69d15 100644 (file)
@@ -107,7 +107,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
     #\r
     # Get/Set Usage and HelpString\r
     #\r
-    if CommentsList != None and len(CommentsList) != 0 :\r
+    if CommentsList is not None and len(CommentsList) != 0 :\r
         CommentInsList = []\r
         PreUsage = None\r
         PreGuidType = None\r
@@ -126,7 +126,7 @@ def ParseGuidComment(CommentsList, InfGuidItemObj):
                                  [], \r
                                  True)\r
             \r
-            if CommentItemHelpText == None:\r
+            if CommentItemHelpText is None:\r
                 CommentItemHelpText = ''\r
                 if Count == len(CommentsList) and CommentItemUsage == CommentItemGuidType == DT.ITEM_UNDEFINED:\r
                     CommentItemHelpText = DT.END_OF_LINE\r
@@ -236,7 +236,7 @@ class InfGuidObject():
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'  \r
             \r
             __SupportArchList.append(ArchItem)\r
index 45fba31aaae9bdf7d0cb550549b3e5f41c65f0a3..dce75063dfb5d3866236bfe0fa588df0e8db7a1e 100644 (file)
@@ -43,7 +43,7 @@ class InfHeaderObject():
     # @param FileName: File Name\r
     #    \r
     def SetFileName(self, FileName):\r
-        if not (FileName == '' or FileName == None):\r
+        if not (FileName == '' or FileName is None):\r
             self.FileName = FileName\r
             return True\r
         else:\r
@@ -59,7 +59,7 @@ class InfHeaderObject():
     # @param Abstract: Abstract\r
     #    \r
     def SetAbstract(self, Abstract):\r
-        if not (Abstract == '' or Abstract == None):\r
+        if not (Abstract == '' or Abstract is None):\r
             self.Abstract = Abstract\r
             return True\r
         else:\r
@@ -75,7 +75,7 @@ class InfHeaderObject():
     # @param Description: Description content \r
     #  \r
     def SetDescription(self, Description):\r
-        if not (Description == '' or Description == None):\r
+        if not (Description == '' or Description is None):\r
             self.Description = Description\r
             return True\r
         else:\r
@@ -91,7 +91,7 @@ class InfHeaderObject():
     # @param Copyright: Copyright content \r
     #      \r
     def SetCopyright(self, Copyright):\r
-        if not (Copyright == '' or Copyright == None):\r
+        if not (Copyright == '' or Copyright is None):\r
             self.Copyright = Copyright\r
             return True\r
         else:\r
@@ -107,7 +107,7 @@ class InfHeaderObject():
     # @param License: License content \r
     #   \r
     def SetLicense(self, License):\r
-        if not (License == '' or License == None):\r
+        if not (License == '' or License is None):\r
             self.License = License\r
             return True\r
         else:\r
index b18c4c381bc0d763d2dc01d9820e708e6a720c03..e588c6ba66d8708f94af412b5caa9023920fd997 100644 (file)
@@ -38,10 +38,10 @@ def GetArchModuleType(KeyList):
         #\r
         # Validate Arch\r
         #            \r
-        if (ArchItem == '' or ArchItem == None):\r
+        if (ArchItem == '' or ArchItem is None):\r
             ArchItem = 'COMMON'\r
 \r
-        if (ModuleItem == '' or ModuleItem == None):\r
+        if (ModuleItem == '' or ModuleItem is None):\r
             ModuleItem = 'COMMON'\r
 \r
         if ArchItem not in __SupArchList:\r
@@ -136,7 +136,7 @@ class InfLibraryClassObject():
                 LibItemObj.CurrentLine.SetLineNo(LibItem[2][1])\r
                 LibItemObj.CurrentLine.SetLineString(LibItem[2][0])\r
                 LibItem = LibItem[0]\r
-                if HelpStringObj != None:\r
+                if HelpStringObj is not None:\r
                     LibItemObj.SetHelpString(HelpStringObj)\r
                 if len(LibItem) >= 1:\r
                     if LibItem[0].strip() != '':\r
index 74099e2088602ef29bac3cf43139774e5d7490b6..37f8cb2336bb6759406105874ee6fd4b013ac397 100644 (file)
@@ -135,9 +135,9 @@ class InfSpecialCommentObject(InfSectionCommonDef):
 # An encapsulate of Error for INF parser.\r
 # \r
 def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):\r
-    if ErrorCode == None:\r
+    if ErrorCode is None:\r
         ErrorCode = ToolError.FORMAT_INVALID\r
-    if LineInfo == None:\r
+    if LineInfo is None:\r
         LineInfo = ['', -1, '']\r
     Logger.Error("InfParser", \r
                  ErrorCode, \r
index 37399134dbf3d133f6bbefe689576e1e50765df2..01c854a8470e09078553c5da1202b76e6563c967 100644 (file)
@@ -75,7 +75,7 @@ class InfPackageObject():
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'\r
             SupArchList.append(ArchItem)       \r
         \r
@@ -84,7 +84,7 @@ class InfPackageObject():
             HelpStringObj = PackageItem[1]\r
             CurrentLineOfPackItem = PackageItem[2]\r
             PackageItem = PackageItem[0]\r
-            if HelpStringObj != None:\r
+            if HelpStringObj is not None:\r
                 HelpString = HelpStringObj.HeaderComments + HelpStringObj.TailComments\r
                 PackageItemObj.SetHelpString(HelpString)                  \r
             if len(PackageItem) >= 1:\r
@@ -183,5 +183,5 @@ class InfPackageObject():
         return True\r
     \r
     def GetPackages(self, Arch = None):\r
-        if Arch == None:\r
+        if Arch is None:\r
             return self.Packages
\ No newline at end of file
index 7b07036f91c207e72b4f880a5bbb532245980c54..d2712a97f2ff34c1be8f3ab22b33d521ff0e90eb 100644 (file)
@@ -43,7 +43,7 @@ def ValidateArch(ArchItem, PcdTypeItem1, LineNo, SupArchDict, SupArchList):
     #\r
     # Validate Arch\r
     #            \r
-    if (ArchItem == '' or ArchItem == None):\r
+    if (ArchItem == '' or ArchItem is None):\r
         ArchItem = 'COMMON'\r
 \r
     if PcdTypeItem1.upper != DT.TAB_INF_FEATURE_PCD.upper():\r
@@ -82,7 +82,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
 \r
         if PcdTypeItem == 'FeaturePcd':\r
             CommentItemUsage = DT.USAGE_ITEM_CONSUMES\r
-            if CommentItemHelpText == None:\r
+            if CommentItemHelpText is None:\r
                 CommentItemHelpText = ''\r
 \r
             if Count == 1:\r
@@ -96,7 +96,7 @@ def ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj):
             else:\r
                 continue\r
 \r
-        if CommentItemHelpText == None:\r
+        if CommentItemHelpText is None:\r
             CommentItemHelpText = ''\r
             if Count == len(CommentList) and CommentItemUsage == DT.ITEM_UNDEFINED:\r
                 CommentItemHelpText = DT.END_OF_LINE\r
@@ -326,7 +326,7 @@ class InfPcdObject():
             #\r
             # Validate PcdType\r
             #\r
-            if (PcdTypeItem1 == '' or PcdTypeItem1 == None):\r
+            if (PcdTypeItem1 == '' or PcdTypeItem1 is None):\r
                 return False\r
             else:\r
                 if not IsValidPcdType(PcdTypeItem1):\r
@@ -346,7 +346,7 @@ class InfPcdObject():
                 CurrentLineOfPcdItem = PcdItem[2]\r
                 PcdItem = PcdItem[0]\r
 \r
-                if CommentList != None and len(CommentList) != 0:\r
+                if CommentList is not None and len(CommentList) != 0:\r
                     PcdItemObj = ParsePcdComment(CommentList, PcdTypeItem, PcdItemObj)\r
                 else:\r
                     CommentItemIns = InfPcdItemCommentContent()\r
index 4df62bb459fffc9e33ae7214d9f3d6aa160fbd90..eb6b6927140bc87a267865b87a6bbfdea22fcae9 100644 (file)
@@ -51,7 +51,7 @@ def ParsePpiComment(CommentsList, InfPpiItemObj):
         if CommentItemString:\r
             pass\r
         \r
-        if CommentItemHelpText == None:\r
+        if CommentItemHelpText is None:\r
             CommentItemHelpText = ''\r
             if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:\r
                 CommentItemHelpText = DT.END_OF_LINE                    \r
@@ -213,7 +213,7 @@ class InfPpiObject():
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'   \r
             __SupArchList.append(ArchItem)\r
             \r
@@ -290,7 +290,7 @@ class InfPpiObject():
             #\r
             # Get/Set Usage and HelpString for PPI entry\r
             #\r
-            if CommentsList != None and len(CommentsList) != 0:\r
+            if CommentsList is not None and len(CommentsList) != 0:\r
                 InfPpiItemObj = ParsePpiComment(CommentsList, InfPpiItemObj)\r
             else:\r
                 CommentItemIns = InfPpiItemCommentContent()\r
index c94e53c98f87d477ca86eb9f90446b65abd9ce24..eb03095d6fecd4f994ea66b0d2bf917b065304b4 100644 (file)
@@ -49,7 +49,7 @@ def ParseProtocolComment(CommentsList, InfProtocolItemObj):
         if CommentItemString:\r
             pass\r
         \r
-        if CommentItemHelpText == None:\r
+        if CommentItemHelpText is None:\r
             CommentItemHelpText = ''\r
             if Count == len(CommentsList) and CommentItemUsage == CommentItemNotify == DT.ITEM_UNDEFINED:\r
                 CommentItemHelpText = DT.END_OF_LINE\r
@@ -203,7 +203,7 @@ class InfProtocolObject():
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'\r
             __SupArchList.append(ArchItem)\r
 \r
@@ -259,7 +259,7 @@ class InfProtocolObject():
             #\r
             # Get/Set Usage and HelpString for Protocol entry\r
             #\r
-            if CommentsList != None and len(CommentsList) != 0:\r
+            if CommentsList is not None and len(CommentsList) != 0:\r
                 InfProtocolItemObj = ParseProtocolComment(CommentsList, InfProtocolItemObj)\r
             else:\r
                 CommentItemIns = InfProtocolItemCommentContent()\r
index 9988f8ecfeedc1ec2ff23d53485def42c01a52e3..2302dd5b96734f9e5733e1bc9d874b6ecd401d04 100644 (file)
@@ -211,7 +211,7 @@ class InfSourcesObject(InfSectionCommonDef):
             #\r
             # Validate Arch\r
             #            \r
-            if (ArchItem == '' or ArchItem == None):\r
+            if (ArchItem == '' or ArchItem is None):\r
                 ArchItem = 'COMMON'  \r
             __SupArchList.append(ArchItem)   \r
 \r
index 498f2d7634a5492832beafc96f63f244e7593db6..4eed04c01765d85c1a240423141cec76d7de9788 100644 (file)
@@ -155,7 +155,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
                                       DT.MODEL_META_DATA_HEADER,\r
                                       DefineSectionMacros)\r
 \r
-            if Name != None:\r
+            if Name is not None:\r
                 DefineSectionMacros[Name] = Value\r
                 continue\r
 \r
@@ -168,7 +168,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
                                       FileNameString,\r
                                       DT.MODEL_META_DATA_PACKAGE,\r
                                       DefineSectionMacros)\r
-            if Name != None:\r
+            if Name is not None:\r
                 PackageSectionMacros[Name] = Value\r
                 continue\r
 \r
index f1d6943cbfff72c9892beab55de13e9d1a596f2b..f220402cb57723311faa6a8900143219d7ec391c 100644 (file)
@@ -112,7 +112,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
             if BinLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                 TailComments = BinLineContent[BinLineContent.find(DT.TAB_COMMENT_SPLIT):]\r
                 BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
-                if LineComment == None:\r
+                if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
                 LineComment.SetTailComments(TailComments)            \r
             \r
@@ -123,7 +123,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
                                       FileName,\r
                                       DT.MODEL_EFI_BINARY_FILE,\r
                                       self.FileLocalMacros)\r
-            if MacroDef[0] != None:\r
+            if MacroDef[0] is not None:\r
                 SectionMacros[MacroDef[0]] = MacroDef[1]\r
                 LineComment = None\r
                 HeaderComments = []                   \r
index d00087a128a09b3bdfb1ea29857ebc2f892b5bcc..f7749d55a0625ab532a1ff0796772b3fffacdd25 100644 (file)
@@ -133,7 +133,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
             if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                 TailComments = LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):]\r
                 LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]\r
-                if LineComment == None:\r
+                if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
                 LineComment.SetTailComments(TailComments)\r
                               \r
@@ -144,7 +144,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
                                       FileName, \r
                                       DT.MODEL_META_DATA_HEADER, \r
                                       self.FileLocalMacros)\r
-            if Name != None:\r
+            if Name is not None:\r
                 self.FileLocalMacros[Name] = Value\r
                 continue            \r
 \r
@@ -173,7 +173,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
             Name, Value = _ValueList[0], _ValueList[1]            \r
             \r
             InfDefMemberObj = InfDefMember(Name, Value)\r
-            if (LineComment != None):\r
+            if (LineComment is not None):\r
                 InfDefMemberObj.Comments.SetHeaderComments(LineComment.GetHeaderComments())\r
                 InfDefMemberObj.Comments.SetTailComments(LineComment.GetTailComments())\r
                 \r
index 5cafc80ca5c37e23ff8a56a3f75c851bcf19f921..332e2f01431013f0d7783bad89fd1a363b02fc82 100644 (file)
@@ -87,7 +87,7 @@ class InfDepexSectionParser(InfParserSectionRoot):
         ReFormatComment = re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)\r
         for CommentItem in DepexComment:\r
             CommentContent = CommentItem[0]\r
-            if ReFormatComment.match(CommentContent) != None:\r
+            if ReFormatComment.match(CommentContent) is not None:\r
                 FormatCommentLn = CommentItem[1] + 1\r
                 continue\r
             \r
index 12ffedaaec617e6376e2e6a71c9b5817a9eaf855..956c116c6e79536e8902c2bc257363ec02ae16fc 100644 (file)
@@ -77,7 +77,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
                                           FileName,\r
                                           DT.MODEL_EFI_GUID,\r
                                           self.FileLocalMacros)\r
-                if Name != None:\r
+                if Name is not None:\r
                     SectionMacros[Name] = Value\r
                     CommentsList = []\r
                     ValueList = []\r
@@ -164,7 +164,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
                                           FileName,\r
                                           DT.MODEL_EFI_PPI,\r
                                           self.FileLocalMacros)\r
-                if Name != None:\r
+                if Name is not None:\r
                     SectionMacros[Name] = Value\r
                     ValueList = []\r
                     CommentsList = []\r
@@ -334,7 +334,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
                                           FileName,\r
                                           DT.MODEL_EFI_PROTOCOL,\r
                                           self.FileLocalMacros)\r
-                if Name != None:\r
+                if Name is not None:\r
                     SectionMacros[Name] = Value\r
                     ValueList = []\r
                     CommentsList = []\r
index 210f973f1a4d30a5b57c0cf1aa394da4e7a79d99..549e67f08d64fbef15c6c81d4a67b771d55bacd7 100644 (file)
@@ -96,7 +96,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
                 if LibLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                     LibTailComments = LibLineContent[LibLineContent.find(DT.TAB_COMMENT_SPLIT):]\r
                     LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
-                    if LibLineComment == None:\r
+                    if LibLineComment is None:\r
                         LibLineComment = InfLineCommentObject()\r
                     LibLineComment.SetTailComments(LibTailComments)\r
 \r
@@ -107,7 +107,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
                                           FileName,\r
                                           DT.MODEL_EFI_LIBRARY_CLASS,\r
                                           self.FileLocalMacros)\r
-                if Name != None:\r
+                if Name is not None:\r
                     SectionMacros[Name] = Value\r
                     LibLineComment = None\r
                     LibHeaderComments = []\r
index 67f1145322ad1799d22f78bd65c130008ca3ab77..8fb2898826e6fff6d71a0339c8fd3e2d9876ec72 100644 (file)
@@ -89,7 +89,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
             if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                 TailComments = PkgLineContent[PkgLineContent.find(DT.TAB_COMMENT_SPLIT):]\r
                 PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
-                if LineComment == None:\r
+                if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
                 LineComment.SetTailComments(TailComments)                   \r
             #\r
@@ -99,7 +99,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
                                       FileName,\r
                                       DT.MODEL_META_DATA_PACKAGE,\r
                                       self.FileLocalMacros)\r
-            if Name != None:\r
+            if Name is not None:\r
                 SectionMacros[Name] = Value\r
                 LineComment = None\r
                 HeaderComments = []                \r
index e7bef2e35e0fea430aefb135d2f39ccb7af214fc..7bea49e0e8616d68d9950aa726da868e28362937 100644 (file)
@@ -97,7 +97,7 @@ class InfParser(InfSectionParser):
         #\r
         # Load Inf file if filename is not None\r
         #\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.ParseInfFile(Filename)\r
 \r
     ## Parse INF file\r
index a416897d27ae014179fa12e98b37c7693b7474d5..6a335e8b6c75fee729bb1d240bf39e06c2b51b5e 100644 (file)
@@ -73,9 +73,9 @@ gINF_SECTION_DEF = {
 # @param Flag          If the flag set to True, need to skip macros in a quoted string \r
 #\r
 def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):\r
-    if GlobalMacros == None:\r
+    if GlobalMacros is None:\r
         GlobalMacros = {}\r
-    if SectionMacros == None:\r
+    if SectionMacros is None:\r
         SectionMacros = {}\r
     \r
     FileName = LineInfo[0]\r
index f4324cc2ff1be69ad03848e8f9ab3236a49c8e83..a9b87fdc0565622ca71e67c174f67408dd200bce 100644 (file)
@@ -95,7 +95,7 @@ class InfPcdSectionParser(InfParserSectionRoot):
                                               FileName,\r
                                               DT.MODEL_EFI_PCD,\r
                                               self.FileLocalMacros)\r
-                    if Name != None:\r
+                    if Name is not None:\r
                         SectionMacros[Name] = Value\r
                         ValueList = []\r
                         CommentsList = []\r
index 51db7960353d8e327ac4d673dd59f0c0e48ecc84..645c2c341460a9a54193db20e54de0ceef654a26 100644 (file)
@@ -86,7 +86,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
             if SrcLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:\r
                 TailComments = SrcLineContent[SrcLineContent.find(DT.TAB_COMMENT_SPLIT):]\r
                 SrcLineContent = SrcLineContent[:SrcLineContent.find(DT.TAB_COMMENT_SPLIT)]\r
-                if LineComment == None:\r
+                if LineComment is None:\r
                     LineComment = InfLineCommentObject()\r
                 LineComment.SetTailComments(TailComments)\r
                                \r
@@ -97,7 +97,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
                                       FileName,\r
                                       DT.MODEL_EFI_SOURCE_FILE,\r
                                       self.FileLocalMacros)\r
-            if Name != None:\r
+            if Name is not None:\r
                 SectionMacros[Name] = Value\r
                 LineComment = None\r
                 HeaderComments = []\r
index a15173285345074de96700b27e7f72fae1eeb5c9..e37a0b6c3be7191cca043ea9172c0fa1d39d11c8 100644 (file)
@@ -167,11 +167,11 @@ class InfPomAlignment(ModuleObject):
         #\r
         # Convert UEFI/PI version to decimal number\r
         #\r
-        if DefineObj.GetUefiSpecificationVersion() != None:\r
+        if DefineObj.GetUefiSpecificationVersion() is not None:\r
             __UefiVersion = DefineObj.GetUefiSpecificationVersion().GetValue()\r
             __UefiVersion = ConvertVersionToDecimal(__UefiVersion)\r
             self.SetUefiSpecificationVersion(str(__UefiVersion))\r
-        if DefineObj.GetPiSpecificationVersion() != None:\r
+        if DefineObj.GetPiSpecificationVersion() is not None:\r
             __PiVersion = DefineObj.GetPiSpecificationVersion().GetValue()\r
             __PiVersion = ConvertVersionToDecimal(__PiVersion)\r
 \r
@@ -186,7 +186,7 @@ class InfPomAlignment(ModuleObject):
         # must exist items in INF define section\r
         # MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING \r
         #\r
-        if DefineObj.GetModuleType() == None:\r
+        if DefineObj.GetModuleType() is None:\r
             Logger.Error("InfParser", FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("MODULE_TYPE"), File=self.FullPath)\r
         else:\r
@@ -205,7 +205,7 @@ class InfPomAlignment(ModuleObject):
                                  Line=DefineObj.ModuleType.CurrentLine.LineNo,\r
                                  ExtraData=DefineObj.ModuleType.CurrentLine.LineString)\r
                 self.LibModuleTypeList.append(ModuleType)\r
-        if DefineObj.GetBaseName() == None:\r
+        if DefineObj.GetBaseName() is None:\r
             Logger.Error("InfParser", FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("BASE_NAME"), File=self.FullPath)\r
         else:\r
@@ -214,17 +214,17 @@ class InfPomAlignment(ModuleObject):
             self.UniFileClassObject = UniFileClassObject([PathClass(DefineObj.GetModuleUniFileName())])\r
         else:\r
             self.UniFileClassObject = None\r
-        if DefineObj.GetInfVersion() == None:\r
+        if DefineObj.GetInfVersion() is None:\r
             Logger.Error("InfParser", FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("INF_VERSION"), File=self.FullPath)\r
         else:\r
             self.SetVersion(DefineObj.GetInfVersion().GetValue())\r
-        if DefineObj.GetFileGuid() == None:\r
+        if DefineObj.GetFileGuid() is None:\r
             Logger.Error("InfParser", FORMAT_INVALID,\r
                          ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("FILE_GUID"), File=self.FullPath)\r
         else:\r
             self.SetGuid(DefineObj.GetFileGuid().GetValue())\r
-        if DefineObj.GetVersionString() == None:\r
+        if DefineObj.GetVersionString() is None:\r
             #\r
             # VERSION_STRING is missing from the [Defines] section, tools must assume that the module's version is 0.\r
             #\r
@@ -256,7 +256,7 @@ class InfPomAlignment(ModuleObject):
             if not (ModuleTypeValue == 'SEC' or ModuleTypeValue == 'PEI_CORE' or ModuleTypeValue == 'PEIM'):\r
                 Logger.Error("InfParser", FORMAT_INVALID, ST.ERR_INF_PARSER_DEFINE_SHADOW_INVALID, File=self.FullPath)\r
 \r
-        if DefineObj.GetPcdIsDriver() != None:\r
+        if DefineObj.GetPcdIsDriver() is not None:\r
             self.SetPcdIsDriver(DefineObj.GetPcdIsDriver().GetValue())\r
         #\r
         # LIBRARY_CLASS\r
@@ -499,7 +499,7 @@ class InfPomAlignment(ModuleObject):
                     LibraryClass.SetSupArchList(ConvertArchList(Item.GetSupArchList()))\r
                     LibraryClass.SetSupModuleList(Item.GetSupModuleList())\r
                     HelpStringObj = Item.GetHelpString()\r
-                    if HelpStringObj != None:\r
+                    if HelpStringObj is not None:\r
                         CommentString = GetHelpStringByRemoveHashKey(HelpStringObj.HeaderComments +\r
                                                                      HelpStringObj.TailComments)\r
                         HelpTextHeaderObj = CommonObject.TextObject()\r
index 042d4784c84cc4666502cc1b56797829201c363b..cca70e5640428efee922907b21fab847f6ed7e4b 100644 (file)
@@ -45,7 +45,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
     CustomMakefile = DefineObj.GetCustomMakefile()\r
     UefiHiiResourceSection = DefineObj.GetUefiHiiResourceSection()\r
 \r
-    if EdkReleaseVersion != None:\r
+    if EdkReleaseVersion is not None:\r
         Name = DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION\r
         Value = EdkReleaseVersion.GetValue()\r
         Statement = _GenInfDefineStateMent(EdkReleaseVersion.Comments.GetHeaderComments(),\r
@@ -54,7 +54,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            EdkReleaseVersion.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if Shadow != None:\r
+    if Shadow is not None:\r
         Name = DT.TAB_INF_DEFINES_SHADOW\r
         Value = Shadow.GetValue()\r
         Statement = _GenInfDefineStateMent(Shadow.Comments.GetHeaderComments(),\r
@@ -63,7 +63,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            Shadow.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if DpxSource != None:\r
+    if DpxSource is not None:\r
         Name = DT.TAB_INF_DEFINES_DPX_SOURCE\r
         for DpxSourceItem in DpxSource:\r
             Value = DpxSourceItem[0]\r
@@ -73,7 +73,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                                DpxSourceItem[1].GetTailComments())\r
             DefinesDictNew[Statement] = ArchString\r
 \r
-    if PciVendorId != None:\r
+    if PciVendorId is not None:\r
         Name = DT.TAB_INF_DEFINES_PCI_VENDOR_ID\r
         Value = PciVendorId.GetValue()\r
         Statement = _GenInfDefineStateMent(PciVendorId.Comments.GetHeaderComments(),\r
@@ -82,7 +82,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            PciVendorId.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if PciDeviceId != None:\r
+    if PciDeviceId is not None:\r
         Name = DT.TAB_INF_DEFINES_PCI_DEVICE_ID\r
         Value = PciDeviceId.GetValue()\r
         Statement = _GenInfDefineStateMent(PciDeviceId.Comments.GetHeaderComments(),\r
@@ -91,7 +91,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            PciDeviceId.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if PciClassCode != None:\r
+    if PciClassCode is not None:\r
         Name = DT.TAB_INF_DEFINES_PCI_CLASS_CODE\r
         Value = PciClassCode.GetValue()\r
         Statement = _GenInfDefineStateMent(PciClassCode.Comments.GetHeaderComments(),\r
@@ -100,7 +100,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            PciClassCode.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if PciRevision != None:\r
+    if PciRevision is not None:\r
         Name = DT.TAB_INF_DEFINES_PCI_REVISION\r
         Value = PciRevision.GetValue()\r
         Statement = _GenInfDefineStateMent(PciRevision.Comments.GetHeaderComments(),\r
@@ -109,7 +109,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
                                            PciRevision.Comments.GetTailComments())\r
         DefinesDictNew[Statement] = ArchString\r
 \r
-    if PciCompress != None:\r
+    if PciCompress is not None:\r
         Name = DT.TAB_INF_DEFINES_PCI_COMPRESS\r
         Value = PciCompress.GetValue()\r
         Statement = _GenInfDefineStateMent(PciCompress.Comments.GetHeaderComments(),\r
@@ -138,7 +138,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
 \r
             DefinesDictNew[Statement] = ArchString\r
 \r
-    if UefiHiiResourceSection != None:\r
+    if UefiHiiResourceSection is not None:\r
         Name = DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION\r
         Value = UefiHiiResourceSection.GetValue()\r
         HeaderComment = UefiHiiResourceSection.Comments.GetHeaderComments()\r
index 325b96bf560dc497e2dcc71ccb080509f984f0cf..09653cdce95f2c22d8aa6508f79a54659fa91450 100644 (file)
@@ -90,7 +90,7 @@ def SetLogLevel(Opt):
         Logger.SetLevel(Logger.VERBOSE)\r
     elif Opt.opt_quiet:\r
         Logger.SetLevel(Logger.QUIET + 1)\r
-    elif Opt.debug_level != None:\r
+    elif Opt.debug_level is not None:\r
         if Opt.debug_level < 0 or Opt.debug_level > 9:\r
             Logger.Warn("UPT", ST.ERR_DEBUG_LEVEL)\r
             Logger.SetLevel(Logger.INFO)\r
index 4dc1c7edab3d97d257552e92cc505081368f1d19..51ac48aca58e02a5e52c8e5643578be09de4b472 100644 (file)
@@ -550,7 +550,7 @@ class ModulePropertyXml(object):
             Hob = Axml.FromXml(SubItem, 'HOB')\r
             self.HOBs.append(Hob)\r
 \r
-        if Header == None:\r
+        if Header is None:\r
             Header = ModuleObject()\r
 \r
         Header.SetModuleType(self.ModuleType)\r
index 58959081d0ab2cadd38eb081cde102ecba0efdd1..dba3b7f5892c21a896a222464bbe858819b371b0 100644 (file)
@@ -162,7 +162,7 @@ class DistributionPackageXml(object):
 \r
 \r
     def FromXml(self, Filename=None):\r
-        if Filename != None:\r
+        if Filename is not None:\r
             self.DistP = DistributionPackageClass()\r
             #\r
             # Load to XML\r
@@ -227,7 +227,7 @@ class DistributionPackageXml(object):
     def ToXml(self, DistP):\r
         if self.DistP:\r
             pass\r
-        if DistP != None:\r
+        if DistP is not None:\r
             #\r
             # Parse DistributionPackageHeader\r
             #\r
@@ -344,7 +344,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Guids']\r
     for Item in Module.GetGuidList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'GuidCName':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -369,7 +369,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Protocols']\r
     for Item in Module.GetProtocolList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Protocol':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -384,7 +384,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PPIs']\r
     for Item in Module.GetPpiList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Ppi':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -399,7 +399,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PcdCoded']\r
     for Item in Module.GetPcdList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PcdEntry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -416,7 +416,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['Externs']\r
     for Item in Module.GetExternList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Extern':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -536,7 +536,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['LibraryClassDefinitions']\r
     for Item in Module.GetLibraryClassList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'LibraryClass':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -608,7 +608,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['SourceFiles']\r
     for Item in Module.GetSourceFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Filename':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -636,7 +636,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
     #\r
     XmlTreeLevel = TopXmlTreeLevel + ['PackageDependencies']\r
     for Item in Module.GetPackageDependencyList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Package':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -649,7 +649,7 @@ def ValidateMS3(Module, TopXmlTreeLevel):
     # Check BinaryFiles -> BinaryFile\r
     #\r
     for Item in Module.GetBinaryFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles']\r
             CheckDict = {'BinaryFile':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
@@ -772,7 +772,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ClonedFrom']\r
     for Item in Package.GetClonedFromList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = Sdict()\r
             CheckDict['GUID'] = ''\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
@@ -787,7 +787,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'LibraryClassDeclarations']\r
     for Item in Package.GetLibraryClassList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'LibraryClass':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -802,7 +802,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'IndustryStandardIncludes']\r
     for Item in Package.GetStandardIncludeFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'IndustryStandardHeader':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -816,7 +816,7 @@ def ValidatePS1(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PackageIncludes']\r
     for Item in Package.GetPackageIncludeFileList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PackageHeader':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -842,7 +842,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'GuidDeclarations']\r
     for Item in Package.GetGuidList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -857,7 +857,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ProtocolDeclarations']\r
     for Item in Package.GetProtocolList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -872,7 +872,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PpiDeclarations']\r
     for Item in Package.GetPpiList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'Entry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
@@ -887,7 +887,7 @@ def ValidatePS2(Package):
     #\r
     XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'PcdDeclarations']\r
     for Item in Package.GetPcdList():\r
-        if Item == None:\r
+        if Item is None:\r
             CheckDict = {'PcdEntry':''}\r
             IsRequiredItemListNull(CheckDict, XmlTreeLevel)\r
 \r
index a306dc0b23049132a09e8123bb0d6297cd6f25e5..90c8246806d86e3fd6451e4be8c249ddcd1172b7 100644 (file)
@@ -212,7 +212,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
index 4d6edadc8f9d008bb5a4ca45d92a70aa23c9de29..49ef1df4aa76bb8e11e06b70e18fb9a826899f5d 100644 (file)
@@ -107,7 +107,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Get current effective macros\r
     def _GetMacros(self):\r
-        if self.__Macros == None:\r
+        if self.__Macros is None:\r
             self.__Macros = {}\r
             self.__Macros.update(GlobalData.gGlobalDefines)\r
         return self.__Macros\r
@@ -145,34 +145,34 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve package name\r
     def _GetPackageName(self):\r
-        if self._PackageName == None:\r
-            if self._Header == None:\r
+        if self._PackageName is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._PackageName == None:\r
+            if self._PackageName is None:\r
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_NAME", File=self.MetaFile)\r
         return self._PackageName\r
 \r
     ## Retrieve file guid\r
     def _GetFileGuid(self):\r
-        if self._Guid == None:\r
-            if self._Header == None:\r
+        if self._Guid is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Guid == None:\r
+            if self._Guid is None:\r
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "No PACKAGE_GUID", File=self.MetaFile)\r
         return self._Guid\r
 \r
     ## Retrieve package version\r
     def _GetVersion(self):\r
-        if self._Version == None:\r
-            if self._Header == None:\r
+        if self._Version is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Version == None:\r
+            if self._Version is None:\r
                 self._Version = ''\r
         return self._Version\r
 \r
     ## Retrieve protocol definitions (name/value pairs)\r
     def _GetProtocol(self):\r
-        if self._Protocols == None:\r
+        if self._Protocols is None:\r
             #\r
             # tdict is a special kind of dict, used for selecting correct\r
             # protocol defition for given ARCH\r
@@ -214,7 +214,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve PPI definitions (name/value pairs)\r
     def _GetPpi(self):\r
-        if self._Ppis == None:\r
+        if self._Ppis is None:\r
             #\r
             # tdict is a special kind of dict, used for selecting correct\r
             # PPI defition for given ARCH\r
@@ -256,7 +256,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve GUID definitions (name/value pairs)\r
     def _GetGuid(self):\r
-        if self._Guids == None:\r
+        if self._Guids is None:\r
             #\r
             # tdict is a special kind of dict, used for selecting correct\r
             # GUID defition for given ARCH\r
@@ -298,7 +298,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve public include paths declared in this package\r
     def _GetInclude(self):\r
-        if self._Includes == None or self._CommonIncludes is None:\r
+        if self._Includes is None or self._CommonIncludes is None:\r
             self._CommonIncludes = []\r
             self._Includes = []\r
             self._PrivateIncludes = []\r
@@ -333,7 +333,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve library class declarations (not used in build at present)\r
     def _GetLibraryClass(self):\r
-        if self._LibraryClasses == None:\r
+        if self._LibraryClasses is None:\r
             #\r
             # tdict is a special kind of dict, used for selecting correct\r
             # library class declaration for given ARCH\r
@@ -357,7 +357,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve PCD declarations\r
     def _GetPcds(self):\r
-        if self._Pcds == None:\r
+        if self._Pcds is None:\r
             self._Pcds = sdict()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
@@ -422,7 +422,7 @@ class DecBuildData(PackageBuildClassObject):
             # will automatically turn to 'common' ARCH and try again\r
             #\r
             Setting,LineNo = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
 \r
             DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)\r
@@ -454,7 +454,7 @@ class DecBuildData(PackageBuildClassObject):
         StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')\r
         for pcd in Pcds.values():\r
             if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
-                if StructPattern.match(pcd.DatumType) == None:\r
+                if StructPattern.match(pcd.DatumType) is None:\r
                     EdkLogger.error('build', FORMAT_INVALID, "DatumType only support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", pcd.DefinitionPosition[0],pcd.DefinitionPosition[1])\r
         for struct_pcd in Pcds.values():\r
             if isinstance(struct_pcd,StructurePcd) and not struct_pcd.StructuredPcdIncludeFile:\r
index 1cc4dc966203e63e80d9afc6bcf399c65cfacf6f..cf9608651269edbe602618e6a84e1fe4f94526e1 100644 (file)
@@ -298,7 +298,7 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Get current effective macros\r
     def _GetMacros(self):\r
-        if self.__Macros == None:\r
+        if self.__Macros is None:\r
             self.__Macros = {}\r
             self.__Macros.update(GlobalData.gPlatformDefines)\r
             self.__Macros.update(GlobalData.gGlobalDefines)\r
@@ -368,7 +368,7 @@ class DscBuildData(PlatformBuildClassObject):
             elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:\r
                 self._BuildTargets = GetSplitValueList(Record[2])\r
             elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:\r
-                if self._SkuName == None:\r
+                if self._SkuName is None:\r
                     self._SkuName = Record[2]\r
                 if GlobalData.gSKUID_CMD:\r
                     self._SkuName = GlobalData.gSKUID_CMD\r
@@ -427,76 +427,76 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Retrieve platform name\r
     def _GetPlatformName(self):\r
-        if self._PlatformName == None:\r
-            if self._Header == None:\r
+        if self._PlatformName is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._PlatformName == None:\r
+            if self._PlatformName is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_NAME", File=self.MetaFile)\r
         return self._PlatformName\r
 \r
     ## Retrieve file guid\r
     def _GetFileGuid(self):\r
-        if self._Guid == None:\r
-            if self._Header == None:\r
+        if self._Guid is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Guid == None:\r
+            if self._Guid is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_GUID", File=self.MetaFile)\r
         return self._Guid\r
 \r
     ## Retrieve platform version\r
     def _GetVersion(self):\r
-        if self._Version == None:\r
-            if self._Header == None:\r
+        if self._Version is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Version == None:\r
+            if self._Version is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No PLATFORM_VERSION", File=self.MetaFile)\r
         return self._Version\r
 \r
     ## Retrieve platform description file version\r
     def _GetDscSpec(self):\r
-        if self._DscSpecification == None:\r
-            if self._Header == None:\r
+        if self._DscSpecification is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._DscSpecification == None:\r
+            if self._DscSpecification is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No DSC_SPECIFICATION", File=self.MetaFile)\r
         return self._DscSpecification\r
 \r
     ## Retrieve OUTPUT_DIRECTORY\r
     def _GetOutpuDir(self):\r
-        if self._OutputDirectory == None:\r
-            if self._Header == None:\r
+        if self._OutputDirectory is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._OutputDirectory == None:\r
+            if self._OutputDirectory is None:\r
                 self._OutputDirectory = os.path.join("Build", self._PlatformName)\r
         return self._OutputDirectory\r
 \r
     ## Retrieve SUPPORTED_ARCHITECTURES\r
     def _GetSupArch(self):\r
-        if self._SupArchList == None:\r
-            if self._Header == None:\r
+        if self._SupArchList is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._SupArchList == None:\r
+            if self._SupArchList is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No SUPPORTED_ARCHITECTURES", File=self.MetaFile)\r
         return self._SupArchList\r
 \r
     ## Retrieve BUILD_TARGETS\r
     def _GetBuildTarget(self):\r
-        if self._BuildTargets == None:\r
-            if self._Header == None:\r
+        if self._BuildTargets is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._BuildTargets == None:\r
+            if self._BuildTargets is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BUILD_TARGETS", File=self.MetaFile)\r
         return self._BuildTargets\r
 \r
     def _GetPcdInfoFlag(self):\r
-        if self._PcdInfoFlag == None or self._PcdInfoFlag.upper() == 'FALSE':\r
+        if self._PcdInfoFlag is None or self._PcdInfoFlag.upper() == 'FALSE':\r
             return False\r
         elif self._PcdInfoFlag.upper() == 'TRUE':\r
             return True\r
         else:\r
             return False\r
     def _GetVarCheckFlag(self):\r
-        if self._VarCheckFlag == None or self._VarCheckFlag.upper() == 'FALSE':\r
+        if self._VarCheckFlag is None or self._VarCheckFlag.upper() == 'FALSE':\r
             return False\r
         elif self._VarCheckFlag.upper() == 'TRUE':\r
             return True\r
@@ -505,10 +505,10 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     # # Retrieve SKUID_IDENTIFIER\r
     def _GetSkuName(self):\r
-        if self._SkuName == None:\r
-            if self._Header == None:\r
+        if self._SkuName is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._SkuName == None:\r
+            if self._SkuName is None:\r
                 self._SkuName = 'DEFAULT'\r
         return self._SkuName\r
 \r
@@ -517,72 +517,72 @@ class DscBuildData(PlatformBuildClassObject):
         self._SkuName = Value\r
 \r
     def _GetFdfFile(self):\r
-        if self._FlashDefinition == None:\r
-            if self._Header == None:\r
+        if self._FlashDefinition is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._FlashDefinition == None:\r
+            if self._FlashDefinition is None:\r
                 self._FlashDefinition = ''\r
         return self._FlashDefinition\r
 \r
     def _GetPrebuild(self):\r
-        if self._Prebuild == None:\r
-            if self._Header == None:\r
+        if self._Prebuild is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Prebuild == None:\r
+            if self._Prebuild is None:\r
                 self._Prebuild = ''\r
         return self._Prebuild\r
 \r
     def _GetPostbuild(self):\r
-        if self._Postbuild == None:\r
-            if self._Header == None:\r
+        if self._Postbuild is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._Postbuild == None:\r
+            if self._Postbuild is None:\r
                 self._Postbuild = ''\r
         return self._Postbuild\r
 \r
     ## Retrieve FLASH_DEFINITION\r
     def _GetBuildNumber(self):\r
-        if self._BuildNumber == None:\r
-            if self._Header == None:\r
+        if self._BuildNumber is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._BuildNumber == None:\r
+            if self._BuildNumber is None:\r
                 self._BuildNumber = ''\r
         return self._BuildNumber\r
 \r
     ## Retrieve MAKEFILE_NAME\r
     def _GetMakefileName(self):\r
-        if self._MakefileName == None:\r
-            if self._Header == None:\r
+        if self._MakefileName is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._MakefileName == None:\r
+            if self._MakefileName is None:\r
                 self._MakefileName = ''\r
         return self._MakefileName\r
 \r
     ## Retrieve BsBaseAddress\r
     def _GetBsBaseAddress(self):\r
-        if self._BsBaseAddress == None:\r
-            if self._Header == None:\r
+        if self._BsBaseAddress is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._BsBaseAddress == None:\r
+            if self._BsBaseAddress is None:\r
                 self._BsBaseAddress = ''\r
         return self._BsBaseAddress\r
 \r
     ## Retrieve RtBaseAddress\r
     def _GetRtBaseAddress(self):\r
-        if self._RtBaseAddress == None:\r
-            if self._Header == None:\r
+        if self._RtBaseAddress is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._RtBaseAddress == None:\r
+            if self._RtBaseAddress is None:\r
                 self._RtBaseAddress = ''\r
         return self._RtBaseAddress\r
 \r
     ## Retrieve the top address for the load fix address\r
     def _GetLoadFixAddress(self):\r
-        if self._LoadFixAddress == None:\r
-            if self._Header == None:\r
+        if self._LoadFixAddress is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
 \r
-            if self._LoadFixAddress == None:\r
+            if self._LoadFixAddress is None:\r
                 self._LoadFixAddress = self._Macros.get(TAB_FIX_LOAD_TOP_MEMORY_ADDRESS, '0')\r
 \r
             try:\r
@@ -608,33 +608,33 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Retrieve RFCLanguage filter\r
     def _GetRFCLanguages(self):\r
-        if self._RFCLanguages == None:\r
-            if self._Header == None:\r
+        if self._RFCLanguages is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._RFCLanguages == None:\r
+            if self._RFCLanguages is None:\r
                 self._RFCLanguages = []\r
         return self._RFCLanguages\r
 \r
     ## Retrieve ISOLanguage filter\r
     def _GetISOLanguages(self):\r
-        if self._ISOLanguages == None:\r
-            if self._Header == None:\r
+        if self._ISOLanguages is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._ISOLanguages == None:\r
+            if self._ISOLanguages is None:\r
                 self._ISOLanguages = []\r
         return self._ISOLanguages\r
     ## Retrieve the GUID string for VPD tool\r
     def _GetVpdToolGuid(self):\r
-        if self._VpdToolGuid == None:\r
-            if self._Header == None:\r
+        if self._VpdToolGuid is None:\r
+            if self._Header is None:\r
                 self._GetHeaderInfo()\r
-            if self._VpdToolGuid == None:\r
+            if self._VpdToolGuid is None:\r
                 self._VpdToolGuid = ''\r
         return self._VpdToolGuid\r
 \r
     ## Retrieve [SkuIds] section information\r
     def _GetSkuIds(self):\r
-        if self._SkuIds == None:\r
+        if self._SkuIds is None:\r
             self._SkuIds = sdict()\r
             RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]\r
             for Record in RecordList:\r
@@ -646,7 +646,7 @@ class DscBuildData(PlatformBuildClassObject):
                                     File=self.MetaFile, Line=Record[-1])\r
                 Pattern = re.compile('^[1-9]\d*|0$')\r
                 HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')\r
-                if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:\r
+                if Pattern.match(Record[0]) is None and HexPattern.match(Record[0]) is None:\r
                     EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",\r
                                     File=self.MetaFile, Line=Record[-1])\r
                 if not IsValidWord(Record[1]):\r
@@ -661,7 +661,7 @@ class DscBuildData(PlatformBuildClassObject):
     def ToInt(self,intstr):\r
         return int(intstr,16) if intstr.upper().startswith("0X") else int(intstr)\r
     def _GetDefaultStores(self):\r
-        if self.DefaultStores == None:\r
+        if self.DefaultStores is None:\r
             self.DefaultStores = sdict()\r
             RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]\r
             for Record in RecordList:\r
@@ -673,7 +673,7 @@ class DscBuildData(PlatformBuildClassObject):
                                     File=self.MetaFile, Line=Record[-1])\r
                 Pattern = re.compile('^[1-9]\d*|0$')\r
                 HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')\r
-                if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:\r
+                if Pattern.match(Record[0]) is None and HexPattern.match(Record[0]) is None:\r
                     EdkLogger.error('build', FORMAT_INVALID, "The format of the DefaultStores ID number is invalid. It only support Integer and HexNumber",\r
                                     File=self.MetaFile, Line=Record[-1])\r
                 if not IsValidWord(Record[1]):\r
@@ -689,7 +689,7 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Retrieve [Components] section information\r
     def _GetModules(self):\r
-        if self._Modules != None:\r
+        if self._Modules is not None:\r
             return self._Modules\r
 \r
         self._Modules = sdict()\r
@@ -788,13 +788,13 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Retrieve all possible library instances used in this platform\r
     def _GetLibraryInstances(self):\r
-        if self._LibraryInstances == None:\r
+        if self._LibraryInstances is None:\r
             self._GetLibraryClasses()\r
         return self._LibraryInstances\r
 \r
     ## Retrieve [LibraryClasses] information\r
     def _GetLibraryClasses(self):\r
-        if self._LibraryClasses == None:\r
+        if self._LibraryClasses is None:\r
             self._LibraryInstances = []\r
             #\r
             # tdict is a special dict kind of type, used for selecting correct\r
@@ -832,7 +832,7 @@ class DscBuildData(PlatformBuildClassObject):
                 # try all possible module types\r
                 for ModuleType in SUP_MODULE_LIST:\r
                     LibraryInstance = LibraryClassDict[self._Arch, ModuleType, LibraryClass]\r
-                    if LibraryInstance == None:\r
+                    if LibraryInstance is None:\r
                         continue\r
                     self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance\r
 \r
@@ -859,7 +859,7 @@ class DscBuildData(PlatformBuildClassObject):
         return self._LibraryClasses\r
 \r
     def _ValidatePcd(self, PcdCName, TokenSpaceGuid, Setting, PcdType, LineNo):\r
-        if self._DecPcds == None:\r
+        if self._DecPcds is None:\r
 \r
             FdfInfList = []\r
             if GlobalData.gFdfParser:\r
@@ -1121,7 +1121,7 @@ class DscBuildData(PlatformBuildClassObject):
 \r
     ## Retrieve all PCD settings in platform\r
     def _GetPcds(self):\r
-        if self._Pcds == None:\r
+        if self._Pcds is None:\r
             self._Pcds = sdict()\r
             self.__ParsePcdFromCommandLine()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
@@ -1156,7 +1156,7 @@ class DscBuildData(PlatformBuildClassObject):
                     print "PcdCName: %s, SkuName: %s, Value: %s" % (".".join((pcdobj.TokenSpaceGuidCName, pcdobj.TokenCName)), skuid,str(pcdobj.SkuInfoList[skuid].DefaultValue))\r
     ## Retrieve [BuildOptions]\r
     def _GetBuildOptions(self):\r
-        if self._BuildOptions == None:\r
+        if self._BuildOptions is None:\r
             self._BuildOptions = sdict()\r
             #\r
             # Retrieve build option for EDKII and EDK style module\r
@@ -1178,7 +1178,7 @@ class DscBuildData(PlatformBuildClassObject):
         return self._BuildOptions\r
 \r
     def GetBuildOptionsByModuleType(self, Edk, ModuleType):\r
-        if self._ModuleTypeOptions == None:\r
+        if self._ModuleTypeOptions is None:\r
             self._ModuleTypeOptions = sdict()\r
         if (Edk, ModuleType) not in self._ModuleTypeOptions:\r
             options = sdict()\r
@@ -1471,7 +1471,7 @@ class DscBuildData(PlatformBuildClassObject):
 \r
         for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet:\r
             Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
             PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)\r
             if (PcdCName, TokenSpaceGuid) in PcdValueDict:\r
@@ -2256,7 +2256,7 @@ class DscBuildData(PlatformBuildClassObject):
         for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:\r
 \r
             Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
 \r
             PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)\r
@@ -2428,7 +2428,7 @@ class DscBuildData(PlatformBuildClassObject):
         for PcdCName, TokenSpaceGuid, SkuName,DefaultStore, Dummy4 in PcdSet:\r
 \r
             Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid,DefaultStore]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
             VariableName, VariableGuid, VariableOffset, DefaultValue, VarAttribute = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)\r
 \r
@@ -2498,7 +2498,7 @@ class DscBuildData(PlatformBuildClassObject):
             pcd.DatumType = pcdDecObject.DatumType\r
             # Only fix the value while no value provided in DSC file.\r
             for sku in pcd.SkuInfoList.values():\r
-                if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue == None):\r
+                if (sku.HiiDefaultValue == "" or sku.HiiDefaultValue is None):\r
                     sku.HiiDefaultValue = pcdDecObject.DefaultValue\r
                     for default_store in sku.DefaultStoreDict:\r
                         sku.DefaultStoreDict[default_store]=pcdDecObject.DefaultValue\r
@@ -2582,7 +2582,7 @@ class DscBuildData(PlatformBuildClassObject):
         # Remove redundant PCD candidates, per the ARCH and SKU\r
         for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdList:\r
             Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
             #\r
             # For the VOID* type, it can have optional data of MaxDatumSize and InitialValue\r
@@ -2691,7 +2691,7 @@ class DscBuildData(PlatformBuildClassObject):
         self.Pcds[Name, Guid].DefaultValue = Value\r
     @property\r
     def DecPcds(self):\r
-        if self._DecPcds == None:\r
+        if self._DecPcds is None:\r
             FdfInfList = []\r
             if GlobalData.gFdfParser:\r
                 FdfInfList = GlobalData.gFdfParser.Profile.InfList\r
index 7ea9b56d5decba82b52e742d15851d1c63ce6619..ded8f610c9c190e0cd107830418452b2660408c2 100644 (file)
@@ -179,7 +179,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Get current effective macros\r
     def _GetMacros(self):\r
-        if self.__Macros == None:\r
+        if self.__Macros is None:\r
             self.__Macros = {}\r
             # EDK_GLOBAL defined macros can be applied to EDK module\r
             if self.AutoGenVersion < 0x00010005:\r
@@ -246,7 +246,7 @@ class InfBuildData(ModuleBuildClassObject):
             # items defined _PROPERTY_ don't need additional processing\r
             if Name in self:\r
                 self[Name] = Value\r
-                if self._Defs == None:\r
+                if self._Defs is None:\r
                     self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
                 self._Macros[Name] = Value\r
@@ -254,15 +254,15 @@ class InfBuildData(ModuleBuildClassObject):
             elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):\r
                 if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):\r
                     Name = 'UEFI_SPECIFICATION_VERSION'\r
-                if self._Specification == None:\r
+                if self._Specification is None:\r
                     self._Specification = sdict()\r
                 self._Specification[Name] = GetHexVerValue(Value)\r
-                if self._Specification[Name] == None:\r
+                if self._Specification[Name] is None:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
                                     "'%s' format is not supported for %s" % (Value, Name),\r
                                     File=self.MetaFile, Line=Record[-1])\r
             elif Name == 'LIBRARY_CLASS':\r
-                if self._LibraryClass == None:\r
+                if self._LibraryClass is None:\r
                     self._LibraryClass = []\r
                 ValueList = GetSplitValueList(Value)\r
                 LibraryClass = ValueList[0]\r
@@ -272,30 +272,30 @@ class InfBuildData(ModuleBuildClassObject):
                     SupModuleList = SUP_MODULE_LIST\r
                 self._LibraryClass.append(LibraryClassObject(LibraryClass, SupModuleList))\r
             elif Name == 'ENTRY_POINT':\r
-                if self._ModuleEntryPointList == None:\r
+                if self._ModuleEntryPointList is None:\r
                     self._ModuleEntryPointList = []\r
                 self._ModuleEntryPointList.append(Value)\r
             elif Name == 'UNLOAD_IMAGE':\r
-                if self._ModuleUnloadImageList == None:\r
+                if self._ModuleUnloadImageList is None:\r
                     self._ModuleUnloadImageList = []\r
                 if not Value:\r
                     continue\r
                 self._ModuleUnloadImageList.append(Value)\r
             elif Name == 'CONSTRUCTOR':\r
-                if self._ConstructorList == None:\r
+                if self._ConstructorList is None:\r
                     self._ConstructorList = []\r
                 if not Value:\r
                     continue\r
                 self._ConstructorList.append(Value)\r
             elif Name == 'DESTRUCTOR':\r
-                if self._DestructorList == None:\r
+                if self._DestructorList is None:\r
                     self._DestructorList = []\r
                 if not Value:\r
                     continue\r
                 self._DestructorList.append(Value)\r
             elif Name == TAB_INF_DEFINES_CUSTOM_MAKEFILE:\r
                 TokenList = GetSplitValueList(Value)\r
-                if self._CustomMakefile == None:\r
+                if self._CustomMakefile is None:\r
                     self._CustomMakefile = {}\r
                 if len(TokenList) < 2:\r
                     self._CustomMakefile['MSFT'] = TokenList[0]\r
@@ -307,7 +307,7 @@ class InfBuildData(ModuleBuildClassObject):
                                         File=self.MetaFile, Line=Record[-1])\r
                     self._CustomMakefile[TokenList[0]] = TokenList[1]\r
             else:\r
-                if self._Defs == None:\r
+                if self._Defs is None:\r
                     self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
                 self._Macros[Name] = Value\r
@@ -329,10 +329,10 @@ class InfBuildData(ModuleBuildClassObject):
                 EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
                                 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType, ' '.join(l for l in SUP_MODULE_LIST)),\r
                                 File=self.MetaFile, Line=LineNo)\r
-            if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):\r
+            if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):\r
                 if self._ModuleType == SUP_MODULE_SMM_CORE:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)\r
-            if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):\r
+            if (self._Specification is None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):\r
                 if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)\r
                 if self._ModuleType == SUP_MODULE_MM_STANDALONE:\r
@@ -357,7 +357,7 @@ class InfBuildData(ModuleBuildClassObject):
                 if ErrorCode != 0:\r
                     EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,\r
                                     File=self.MetaFile, Line=LineNo)\r
-                if self.Sources == None:\r
+                if self.Sources is None:\r
                     self._Sources = []\r
                 self._Sources.append(File)\r
         else:\r
@@ -377,7 +377,7 @@ class InfBuildData(ModuleBuildClassObject):
             for Name, Value, Dummy, Arch, Platform, ID, LineNo in RecordList:\r
                 Value = ReplaceMacro(Value, Macros, True)\r
                 if Name == "IMAGE_ENTRY_POINT":\r
-                    if self._ModuleEntryPointList == None:\r
+                    if self._ModuleEntryPointList is None:\r
                         self._ModuleEntryPointList = []\r
                     self._ModuleEntryPointList.append(Value)\r
                 elif Name == "DPX_SOURCE":\r
@@ -387,7 +387,7 @@ class InfBuildData(ModuleBuildClassObject):
                     if ErrorCode != 0:\r
                         EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,\r
                                         File=self.MetaFile, Line=LineNo)\r
-                    if self.Sources == None:\r
+                    if self.Sources is None:\r
                         self._Sources = []\r
                     self._Sources.append(File)\r
                 else:\r
@@ -397,7 +397,7 @@ class InfBuildData(ModuleBuildClassObject):
 #                        EdkLogger.warn("build", "Don't know how to do with macro [%s]" % Name,\r
 #                                       File=self.MetaFile, Line=LineNo)\r
                     else:\r
-                        if self._BuildOptions == None:\r
+                        if self._BuildOptions is None:\r
                             self._BuildOptions = sdict()\r
 \r
                         if ToolList[0] in self._TOOL_CODE_:\r
@@ -424,7 +424,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve file version\r
     def _GetInfVersion(self):\r
-        if self._AutoGenVersion == None:\r
+        if self._AutoGenVersion is None:\r
             RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 if Record[1] == TAB_INF_DEFINES_INF_VERSION:\r
@@ -436,34 +436,34 @@ class InfBuildData(ModuleBuildClassObject):
                     else:\r
                         self._AutoGenVersion = int(Record[2], 0)\r
                     break\r
-            if self._AutoGenVersion == None:\r
+            if self._AutoGenVersion is None:\r
                 self._AutoGenVersion = 0x00010000\r
         return self._AutoGenVersion\r
 \r
     ## Retrieve BASE_NAME\r
     def _GetBaseName(self):\r
-        if self._BaseName == None:\r
-            if self._Header_ == None:\r
+        if self._BaseName is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._BaseName == None:\r
+            if self._BaseName is None:\r
                 EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BASE_NAME name", File=self.MetaFile)\r
         return self._BaseName\r
 \r
     ## Retrieve DxsFile\r
     def _GetDxsFile(self):\r
-        if self._DxsFile == None:\r
-            if self._Header_ == None:\r
+        if self._DxsFile is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._DxsFile == None:\r
+            if self._DxsFile is None:\r
                 self._DxsFile = ''\r
         return self._DxsFile\r
 \r
     ## Retrieve MODULE_TYPE\r
     def _GetModuleType(self):\r
-        if self._ModuleType == None:\r
-            if self._Header_ == None:\r
+        if self._ModuleType is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._ModuleType == None:\r
+            if self._ModuleType is None:\r
                 self._ModuleType = 'BASE'\r
             if self._ModuleType not in SUP_MODULE_LIST:\r
                 self._ModuleType = "USER_DEFINED"\r
@@ -471,17 +471,17 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve COMPONENT_TYPE\r
     def _GetComponentType(self):\r
-        if self._ComponentType == None:\r
-            if self._Header_ == None:\r
+        if self._ComponentType is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._ComponentType == None:\r
+            if self._ComponentType is None:\r
                 self._ComponentType = 'USER_DEFINED'\r
         return self._ComponentType\r
 \r
     ## Retrieve "BUILD_TYPE"\r
     def _GetBuildType(self):\r
-        if self._BuildType == None:\r
-            if self._Header_ == None:\r
+        if self._BuildType is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
             if not self._BuildType:\r
                 self._BuildType = "BASE"\r
@@ -489,37 +489,37 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve file guid\r
     def _GetFileGuid(self):\r
-        if self._Guid == None:\r
-            if self._Header_ == None:\r
+        if self._Guid is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._Guid == None:\r
+            if self._Guid is None:\r
                 self._Guid = '00000000-0000-0000-0000-000000000000'\r
         return self._Guid\r
 \r
     ## Retrieve module version\r
     def _GetVersion(self):\r
-        if self._Version == None:\r
-            if self._Header_ == None:\r
+        if self._Version is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._Version == None:\r
+            if self._Version is None:\r
                 self._Version = '0.0'\r
         return self._Version\r
 \r
     ## Retrieve PCD_IS_DRIVER\r
     def _GetPcdIsDriver(self):\r
-        if self._PcdIsDriver == None:\r
-            if self._Header_ == None:\r
+        if self._PcdIsDriver is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._PcdIsDriver == None:\r
+            if self._PcdIsDriver is None:\r
                 self._PcdIsDriver = ''\r
         return self._PcdIsDriver\r
 \r
     ## Retrieve SHADOW\r
     def _GetShadow(self):\r
-        if self._Shadow == None:\r
-            if self._Header_ == None:\r
+        if self._Shadow is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._Shadow != None and self._Shadow.upper() == 'TRUE':\r
+            if self._Shadow is not None and self._Shadow.upper() == 'TRUE':\r
                 self._Shadow = True\r
             else:\r
                 self._Shadow = False\r
@@ -527,79 +527,79 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve CUSTOM_MAKEFILE\r
     def _GetMakefile(self):\r
-        if self._CustomMakefile == None:\r
-            if self._Header_ == None:\r
+        if self._CustomMakefile is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._CustomMakefile == None:\r
+            if self._CustomMakefile is None:\r
                 self._CustomMakefile = {}\r
         return self._CustomMakefile\r
 \r
     ## Retrieve EFI_SPECIFICATION_VERSION\r
     def _GetSpec(self):\r
-        if self._Specification == None:\r
-            if self._Header_ == None:\r
+        if self._Specification is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._Specification == None:\r
+            if self._Specification is None:\r
                 self._Specification = {}\r
         return self._Specification\r
 \r
     ## Retrieve LIBRARY_CLASS\r
     def _GetLibraryClass(self):\r
-        if self._LibraryClass == None:\r
-            if self._Header_ == None:\r
+        if self._LibraryClass is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._LibraryClass == None:\r
+            if self._LibraryClass is None:\r
                 self._LibraryClass = []\r
         return self._LibraryClass\r
 \r
     ## Retrieve ENTRY_POINT\r
     def _GetEntryPoint(self):\r
-        if self._ModuleEntryPointList == None:\r
-            if self._Header_ == None:\r
+        if self._ModuleEntryPointList is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._ModuleEntryPointList == None:\r
+            if self._ModuleEntryPointList is None:\r
                 self._ModuleEntryPointList = []\r
         return self._ModuleEntryPointList\r
 \r
     ## Retrieve UNLOAD_IMAGE\r
     def _GetUnloadImage(self):\r
-        if self._ModuleUnloadImageList == None:\r
-            if self._Header_ == None:\r
+        if self._ModuleUnloadImageList is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._ModuleUnloadImageList == None:\r
+            if self._ModuleUnloadImageList is None:\r
                 self._ModuleUnloadImageList = []\r
         return self._ModuleUnloadImageList\r
 \r
     ## Retrieve CONSTRUCTOR\r
     def _GetConstructor(self):\r
-        if self._ConstructorList == None:\r
-            if self._Header_ == None:\r
+        if self._ConstructorList is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._ConstructorList == None:\r
+            if self._ConstructorList is None:\r
                 self._ConstructorList = []\r
         return self._ConstructorList\r
 \r
     ## Retrieve DESTRUCTOR\r
     def _GetDestructor(self):\r
-        if self._DestructorList == None:\r
-            if self._Header_ == None:\r
+        if self._DestructorList is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._DestructorList == None:\r
+            if self._DestructorList is None:\r
                 self._DestructorList = []\r
         return self._DestructorList\r
 \r
     ## Retrieve definies other than above ones\r
     def _GetDefines(self):\r
-        if self._Defs == None:\r
-            if self._Header_ == None:\r
+        if self._Defs is None:\r
+            if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
-            if self._Defs == None:\r
+            if self._Defs is None:\r
                 self._Defs = sdict()\r
         return self._Defs\r
 \r
     ## Retrieve binary files\r
     def _GetBinaries(self):\r
-        if self._Binaries == None:\r
+        if self._Binaries is None:\r
             self._Binaries = []\r
             RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]\r
             Macros = self._Macros\r
@@ -646,7 +646,7 @@ class InfBuildData(ModuleBuildClassObject):
             self._Sources = []\r
             return self._Sources\r
 \r
-        if self._Sources == None:\r
+        if self._Sources is None:\r
             self._Sources = []\r
             RecordList = self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, self._Platform]\r
             Macros = self._Macros\r
@@ -687,7 +687,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve library classes employed by this module\r
     def _GetLibraryClassUses(self):\r
-        if self._LibraryClasses == None:\r
+        if self._LibraryClasses is None:\r
             self._LibraryClasses = sdict()\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, self._Platform]\r
             for Record in RecordList:\r
@@ -700,7 +700,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve library names (for Edk.x style of modules)\r
     def _GetLibraryNames(self):\r
-        if self._Libraries == None:\r
+        if self._Libraries is None:\r
             self._Libraries = []\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch, self._Platform]\r
             for Record in RecordList:\r
@@ -716,14 +716,14 @@ class InfBuildData(ModuleBuildClassObject):
         return self._ProtocolComments\r
     ## Retrieve protocols consumed/produced by this module\r
     def _GetProtocols(self):\r
-        if self._Protocols == None:\r
+        if self._Protocols is None:\r
             self._Protocols = sdict()\r
             self._ProtocolComments = sdict()\r
             RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
                 Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path)\r
-                if Value == None:\r
+                if Value is None:\r
                     PackageList = "\n\t".join([str(P) for P in self.Packages])\r
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
                                     "Value of Protocol [%s] is not found under [Protocols] section in" % CName,\r
@@ -741,14 +741,14 @@ class InfBuildData(ModuleBuildClassObject):
         return self._PpiComments\r
     ## Retrieve PPIs consumed/produced by this module\r
     def _GetPpis(self):\r
-        if self._Ppis == None:\r
+        if self._Ppis is None:\r
             self._Ppis = sdict()\r
             self._PpiComments = sdict()\r
             RecordList = self._RawData[MODEL_EFI_PPI, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
                 Value = PpiValue(CName, self.Packages, self.MetaFile.Path)\r
-                if Value == None:\r
+                if Value is None:\r
                     PackageList = "\n\t".join([str(P) for P in self.Packages])\r
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
                                     "Value of PPI [%s] is not found under [Ppis] section in " % CName,\r
@@ -766,14 +766,14 @@ class InfBuildData(ModuleBuildClassObject):
         return self._GuidComments\r
     ## Retrieve GUIDs consumed/produced by this module\r
     def _GetGuids(self):\r
-        if self._Guids == None:\r
+        if self._Guids is None:\r
             self._Guids = sdict()\r
             self._GuidComments = sdict()\r
             RecordList = self._RawData[MODEL_EFI_GUID, self._Arch, self._Platform]\r
             for Record in RecordList:\r
                 CName = Record[0]\r
                 Value = GuidValue(CName, self.Packages, self.MetaFile.Path)\r
-                if Value == None:\r
+                if Value is None:\r
                     PackageList = "\n\t".join([str(P) for P in self.Packages])\r
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
                                     "Value of Guid [%s] is not found under [Guids] section in" % CName,\r
@@ -788,7 +788,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve include paths necessary for this module (for Edk.x style of modules)\r
     def _GetIncludes(self):\r
-        if self._Includes == None:\r
+        if self._Includes is None:\r
             self._Includes = []\r
             if self._SourceOverridePath:\r
                 self._Includes.append(self._SourceOverridePath)\r
@@ -845,7 +845,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve packages this module depends on\r
     def _GetPackages(self):\r
-        if self._Packages == None:\r
+        if self._Packages is None:\r
             self._Packages = []\r
             RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]\r
             Macros = self._Macros\r
@@ -868,7 +868,7 @@ class InfBuildData(ModuleBuildClassObject):
         return self._PcdComments\r
     ## Retrieve PCDs used in this module\r
     def _GetPcds(self):\r
-        if self._Pcds == None:\r
+        if self._Pcds is None:\r
             self._Pcds = sdict()\r
             self._PcdComments = sdict()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
@@ -880,7 +880,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve build options specific to this module\r
     def _GetBuildOptions(self):\r
-        if self._BuildOptions == None:\r
+        if self._BuildOptions is None:\r
             self._BuildOptions = sdict()\r
             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, self._Platform]\r
             for Record in RecordList:\r
@@ -897,13 +897,13 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve dependency expression\r
     def _GetDepex(self):\r
-        if self._Depex == None:\r
+        if self._Depex is None:\r
             self._Depex = tdict(False, 2)\r
             RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]\r
 \r
             # If the module has only Binaries and no Sources, then ignore [Depex]\r
-            if self.Sources == None or self.Sources == []:\r
-                if self.Binaries != None and self.Binaries != []:\r
+            if self.Sources is None or self.Sources == []:\r
+                if self.Binaries is not None and self.Binaries != []:\r
                     return self._Depex\r
 \r
             # PEIM and DXE drivers must have a valid [Depex] section\r
@@ -935,18 +935,18 @@ class InfBuildData(ModuleBuildClassObject):
                     elif Token.endswith(".inf"):  # module file name\r
                         ModuleFile = os.path.normpath(Token)\r
                         Module = self.BuildDatabase[ModuleFile]\r
-                        if Module == None:\r
+                        if Module is None:\r
                             EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Module is not found in active platform",\r
                                             ExtraData=Token, File=self.MetaFile, Line=Record[-1])\r
                         DepexList.append(Module.Guid)\r
                     else:\r
                         # get the GUID value now\r
                         Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path)\r
-                        if Value == None:\r
+                        if Value is None:\r
                             Value = PpiValue(Token, self.Packages, self.MetaFile.Path)\r
-                            if Value == None:\r
+                            if Value is None:\r
                                 Value = GuidValue(Token, self.Packages, self.MetaFile.Path)\r
-                        if Value == None:\r
+                        if Value is None:\r
                             PackageList = "\n\t".join([str(P) for P in self.Packages])\r
                             EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
                                             "Value of [%s] is not found in" % Token,\r
@@ -958,7 +958,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     ## Retrieve depedency expression\r
     def _GetDepexExpression(self):\r
-        if self._DepexExpression == None:\r
+        if self._DepexExpression is None:\r
             self._DepexExpression = tdict(False, 2)\r
             RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]\r
             DepexExpression = sdict()\r
@@ -989,7 +989,7 @@ class InfBuildData(ModuleBuildClassObject):
             # get the guid value\r
             if TokenSpaceGuid not in self.Guids:\r
                 Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path)\r
-                if Value == None:\r
+                if Value is None:\r
                     PackageList = "\n\t".join([str(P) for P in self.Packages])\r
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,\r
                                     "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid,\r
@@ -1006,7 +1006,7 @@ class InfBuildData(ModuleBuildClassObject):
         for PcdCName, TokenSpaceGuid in PcdList:\r
             PcdRealName = PcdCName\r
             Setting, LineNo = PcdDict[self._Arch, self.Platform, PcdCName, TokenSpaceGuid]\r
-            if Setting == None:\r
+            if Setting is None:\r
                 continue\r
             ValueList = AnalyzePcdData(Setting)\r
             DefaultValue = ValueList[0]\r
@@ -1095,7 +1095,7 @@ class InfBuildData(ModuleBuildClassObject):
                     #\r
                     # Check whether the token value exist or not.\r
                     #\r
-                    if Pcd.TokenValue == None or Pcd.TokenValue == "":\r
+                    if Pcd.TokenValue is None or Pcd.TokenValue == "":\r
                         EdkLogger.error(\r
                                 'build',\r
                                 FORMAT_INVALID,\r
@@ -1108,7 +1108,7 @@ class InfBuildData(ModuleBuildClassObject):
                     #\r
                     ReIsValidPcdTokenValue = re.compile(r"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re.DOTALL)\r
                     if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):\r
-                        if ReIsValidPcdTokenValue.match(Pcd.TokenValue) == None:\r
+                        if ReIsValidPcdTokenValue.match(Pcd.TokenValue) is None:\r
                             EdkLogger.error(\r
                                     'build',\r
                                     FORMAT_INVALID,\r
index ee4ba6869f8034a8d2cc6b2e2d0ebbc1092865ee..0cfec902326186dbda52d23281de47387f9d4a07 100644 (file)
@@ -113,7 +113,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
@@ -311,7 +311,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 2eb4c75e46587f8b7e238060abbfbd4b852ce971..f4c1868483d9fd0c882d252fddd1fa4752d677b6 100644 (file)
@@ -241,7 +241,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._FilterRecordList(self._RawTable.Query(*DataInfo), self._Arch)\r
 \r
         # Do post-process if necessary\r
@@ -620,7 +620,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
                 Comments = []\r
                 continue\r
@@ -952,7 +952,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
@@ -1361,7 +1361,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
@@ -1740,7 +1740,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
index d8549c9d66e674cc7661b850c198ab386b05a4f5..be3fb3d688569c679099303804fb1f7da0d6044b 100644 (file)
@@ -140,11 +140,11 @@ class ModuleTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>=0" % Model\r
         ValueString = "Value1,Value2,Value3,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
-        if BelongsToItem != None:\r
+        if BelongsToItem is not None:\r
             ConditionString += " AND BelongsToItem=%s" % BelongsToItem\r
 \r
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
@@ -221,7 +221,7 @@ class PackageTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>=0" % Model\r
         ValueString = "Value1,Value2,Value3,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
 \r
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
@@ -341,9 +341,9 @@ class PlatformTable(MetaFileTable):
         ConditionString = "Model=%s AND Enabled>0" % Model\r
         ValueString = "Value1,Value2,Value3,Scope1,Scope2,Scope3,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
             # Cover the case that CodeBase is 'COMMON' for BuildOptions section\r
             if '.' in Scope2:\r
                 Index = Scope2.index('.')\r
@@ -352,12 +352,12 @@ class PlatformTable(MetaFileTable):
             else:\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 c760e57b8f64d0699791e8361098a751b2974598..abe34cf9a071ec60cda6b030310c78b1871ebd50 100644 (file)
@@ -118,16 +118,16 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
                     LibraryPath = PlatformModule.LibraryClasses[LibraryClassName]\r
                 else:\r
                     LibraryPath = 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
                         return []\r
 \r
                 LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]\r
                 # 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
@@ -139,7 +139,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
             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
@@ -239,12 +239,12 @@ def _ResolveLibraryReference(Module, Platform):
         M = LibraryConsumerList.pop()\r
         for LibraryName in M.Libraries:\r
             Library = Platform.LibraryClasses[LibraryName, ':dummy:']\r
-            if Library == None:\r
+            if Library is None:\r
                 for Key in Platform.LibraryClasses.data.keys():\r
                     if LibraryName.upper() == Key.upper():\r
                         Library = Platform.LibraryClasses[Key, ':dummy:']\r
                         break\r
-                if Library == None:\r
+                if Library is None:\r
                     continue\r
 \r
             if Library not in LibraryList:\r
index a3407d113e0f437dbb2b6a5af65cd65d1a3969d8..2b888c0610c32576fd7168093183b76021723498 100644 (file)
@@ -214,7 +214,7 @@ class WorkspaceDatabase(object):
         else:\r
             curPath  = os.path.dirname(__file__) # curPath is the path of WorkspaceDatabase.py\r
             rootPath = os.path.split(curPath)[0] # rootPath is root path of python source, such as /BaseTools/Source/Python\r
-            if rootPath == "" or rootPath == None:\r
+            if rootPath == "" or rootPath is None:\r
                 EdkLogger.verbose("\nFail to find the root path of build.exe or python sources, so can not \\r
 determine whether database file is out of date!\n")\r
         \r
@@ -308,13 +308,13 @@ determine whether database file is out of date!\n")
                 Platform = self.BuildObject[PathClass(PlatformFile), 'COMMON']\r
             except:\r
                 Platform = None\r
-            if Platform != None:\r
+            if Platform is not None:\r
                 PlatformList.append(Platform)\r
         return PlatformList\r
 \r
     def _MapPlatform(self, Dscfile):\r
         Platform = self.BuildObject[PathClass(Dscfile), 'COMMON']\r
-        if Platform == None:\r
+        if Platform is None:\r
             EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC file: %s" % Dscfile)\r
         return Platform\r
 \r
index d555dce9b3bc3f15dfda855868520e4b3f4168e0..966a2aa5abf1a27fcd931ef5378d2d3b3c49ea06 100644 (file)
@@ -722,7 +722,7 @@ def ReadMessage(From, To, ExitFlag):
         # read one line a time\r
         Line = From.readline()\r
         # empty string means "end"\r
-        if Line != None and Line != "":\r
+        if Line is not None and Line != "":\r
             To(Line.rstrip())\r
         else:\r
             break\r
@@ -904,7 +904,7 @@ class PcdReport(object):
         elif ReportSubType == 2:\r
             PcdDict = self.UnusedPcds\r
 \r
-        if ModulePcdSet == None:\r
+        if ModulePcdSet is None:\r
             FileWrite(File, gSectionStart)\r
             if ReportSubType == 1:\r
                 FileWrite(File, "Conditional Directives used by the build system")\r
@@ -966,7 +966,7 @@ class PcdReport(object):
                     PcdValue = DecDefaultValue\r
                     if DscDefaultValue:\r
                         PcdValue = DscDefaultValue\r
-                    if ModulePcdSet != None:\r
+                    if ModulePcdSet is not None:\r
                         if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet:\r
                             continue\r
                         InfDefault, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type]\r
@@ -985,7 +985,7 @@ class PcdReport(object):
                                 break\r
 \r
                     if First:\r
-                        if ModulePcdSet == None:\r
+                        if ModulePcdSet is None:\r
                             FileWrite(File, "")\r
                         FileWrite(File, Key)\r
                         First = False\r
@@ -993,35 +993,35 @@ class PcdReport(object):
 \r
                     if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):\r
                         PcdValueNumber = int(PcdValue.strip(), 0)\r
-                        if DecDefaultValue == None:\r
+                        if DecDefaultValue is None:\r
                             DecMatch = True\r
                         else:\r
                             DecDefaultValueNumber = int(DecDefaultValue.strip(), 0)\r
                             DecMatch = (DecDefaultValueNumber == PcdValueNumber)\r
 \r
-                        if InfDefaultValue == None:\r
+                        if InfDefaultValue is None:\r
                             InfMatch = True\r
                         else:\r
                             InfDefaultValueNumber = int(InfDefaultValue.strip(), 0)\r
                             InfMatch = (InfDefaultValueNumber == PcdValueNumber)\r
 \r
-                        if DscDefaultValue == None:\r
+                        if DscDefaultValue is None:\r
                             DscMatch = True\r
                         else:\r
                             DscDefaultValueNumber = int(DscDefaultValue.strip(), 0)\r
                             DscMatch = (DscDefaultValueNumber == PcdValueNumber)\r
                     else:\r
-                        if DecDefaultValue == None:\r
+                        if DecDefaultValue is None:\r
                             DecMatch = True\r
                         else:\r
                             DecMatch = (DecDefaultValue.strip() == PcdValue.strip())\r
 \r
-                        if InfDefaultValue == None:\r
+                        if InfDefaultValue is None:\r
                             InfMatch = True\r
                         else:\r
                             InfMatch = (InfDefaultValue.strip() == PcdValue.strip())\r
 \r
-                        if DscDefaultValue == None:\r
+                        if DscDefaultValue is None:\r
                             DscMatch = True\r
                         else:\r
                             DscMatch = (DscDefaultValue.strip() == PcdValue.strip())\r
@@ -1087,7 +1087,7 @@ class PcdReport(object):
                         else:\r
                             self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')\r
 \r
-                    if ModulePcdSet == None:\r
+                    if ModulePcdSet is None:\r
                         if IsStructure:\r
                             continue\r
                         if not TypeName in ('PATCH', 'FLAG', 'FIXED'):\r
@@ -1111,7 +1111,7 @@ class PcdReport(object):
                                 else:\r
                                     FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))\r
 \r
-        if ModulePcdSet == None:\r
+        if ModulePcdSet is None:\r
             FileWrite(File, gSectionEnd)\r
         else:\r
             if not ReportSubType and ModulePcdSet:\r
@@ -1127,7 +1127,7 @@ class PcdReport(object):
         return HasDscOverride\r
 \r
     def PrintPcdDefault(self, File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue):\r
-        if not DscMatch and DscDefaultValue != None:\r
+        if not DscMatch and DscDefaultValue is not None:\r
             Value = DscDefaultValue.strip()\r
             IsByteArray, ArrayList = ByteArrayForamt(Value)\r
             if IsByteArray:\r
@@ -1136,7 +1136,7 @@ class PcdReport(object):
                     FileWrite(File, '%s' % (Array))\r
             else:\r
                 FileWrite(File, '    %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value))\r
-        if not InfMatch and InfDefaultValue != None:\r
+        if not InfMatch and InfDefaultValue is not None:\r
             Value = InfDefaultValue.strip()\r
             IsByteArray, ArrayList = ByteArrayForamt(Value)\r
             if IsByteArray:\r
@@ -1146,7 +1146,7 @@ class PcdReport(object):
             else:\r
                 FileWrite(File, '    %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value))\r
 \r
-        if not DecMatch and DecDefaultValue != None:\r
+        if not DecMatch and DecDefaultValue is not None:\r
             Value = DecDefaultValue.strip()\r
             IsByteArray, ArrayList = ByteArrayForamt(Value)\r
             if IsByteArray:\r
@@ -1971,7 +1971,7 @@ class PlatformReport(object):
             self.PcdReport = PcdReport(Wa)\r
 \r
         self.FdReportList = []\r
-        if "FLASH" in ReportType and Wa.FdfProfile and MaList == None:\r
+        if "FLASH" in ReportType and Wa.FdfProfile and MaList is None:\r
             for Fd in Wa.FdfProfile.FdDict:\r
                 self.FdReportList.append(FdReport(Wa.FdfProfile.FdDict[Fd], Wa))\r
 \r
@@ -1984,7 +1984,7 @@ class PlatformReport(object):
             self.DepexParser = DepexParser(Wa)\r
             \r
         self.ModuleReportList = []\r
-        if MaList != None:\r
+        if MaList is not None:\r
             self._IsModuleBuild = True\r
             for Ma in MaList:\r
                 self.ModuleReportList.append(ModuleReport(Ma, ReportType))\r
@@ -1994,13 +1994,13 @@ class PlatformReport(object):
                 ModuleAutoGenList = []\r
                 for ModuleKey in Pa.Platform.Modules:\r
                     ModuleAutoGenList.append(Pa.Platform.Modules[ModuleKey].M)\r
-                if GlobalData.gFdfParser != None:\r
+                if GlobalData.gFdfParser is not None:\r
                     if Pa.Arch in GlobalData.gFdfParser.Profile.InfDict:\r
                         INFList = GlobalData.gFdfParser.Profile.InfDict[Pa.Arch]\r
                         for InfName in INFList:\r
                             InfClass = PathClass(NormPath(InfName), Wa.WorkspaceDir, Pa.Arch)\r
                             Ma = ModuleAutoGen(Wa, InfClass, Pa.BuildTarget, Pa.ToolChain, Pa.Arch, Wa.MetaFile)\r
-                            if Ma == None:\r
+                            if Ma is None:\r
                                 continue\r
                             if Ma not in ModuleAutoGenList:\r
                                 ModuleAutoGenList.append(Ma)\r
index 85612d90ced10cdeffc75e9eb324cec26351f0fc..f211f8c641167ae2894e6370dc719ef52d1fae44 100644 (file)
@@ -241,7 +241,7 @@ def ReadMessage(From, To, ExitFlag):
         # read one line a time\r
         Line = From.readline()\r
         # empty string means "end"\r
-        if Line != None and Line != "":\r
+        if Line is not None and Line != "":\r
             To(Line.rstrip())\r
         else:\r
             break\r
@@ -299,9 +299,9 @@ def LaunchCommand(Command, WorkingDir):
     except: # in case of aborting\r
         # terminate the threads redirecting the program output\r
         EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
-        if EndOfProcedure != None:\r
+        if EndOfProcedure is not None:\r
             EndOfProcedure.set()\r
-        if Proc == None:\r
+        if Proc is None:\r
             if type(Command) != type(""):\r
                 Command = " ".join(Command)\r
             EdkLogger.error("build", COMMAND_FAILURE, "Failed to start command", ExtraData="%s [%s]" % (Command, WorkingDir))\r
@@ -375,7 +375,7 @@ class BuildUnit:
     #   @param  Other       The other BuildUnit object compared to\r
     #\r
     def __eq__(self, Other):\r
-        return Other != None and self.BuildObject == Other.BuildObject \\r
+        return Other is not None and self.BuildObject == Other.BuildObject \\r
                 and self.BuildObject.Arch == Other.BuildObject.Arch\r
 \r
     ## hash() method\r
@@ -633,7 +633,7 @@ class BuildTask:
         self.BuildItem = BuildItem\r
 \r
         self.DependencyList = []\r
-        if Dependency == None:\r
+        if Dependency is None:\r
             Dependency = BuildItem.Dependency\r
         else:\r
             Dependency.extend(BuildItem.Dependency)\r
@@ -795,7 +795,7 @@ class Build():
                 BinCacheSource = mws.join(self.WorkspaceDir, BinCacheSource)\r
             GlobalData.gBinCacheSource = BinCacheSource\r
         else:\r
-            if GlobalData.gBinCacheSource != None:\r
+            if GlobalData.gBinCacheSource is not None:\r
                 EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-source.")\r
 \r
         if GlobalData.gBinCacheDest:\r
@@ -804,7 +804,7 @@ class Build():
                 BinCacheDest = mws.join(self.WorkspaceDir, BinCacheDest)\r
             GlobalData.gBinCacheDest = BinCacheDest\r
         else:\r
-            if GlobalData.gBinCacheDest != None:\r
+            if GlobalData.gBinCacheDest is not None:\r
                 EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-destination.")\r
 \r
         if self.ConfDirectory:\r
@@ -907,7 +907,7 @@ class Build():
         # if no tool chain given in command line, get it from target.txt\r
         if not self.ToolChainList:\r
             self.ToolChainList = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]\r
-            if self.ToolChainList == None or len(self.ToolChainList) == 0:\r
+            if self.ToolChainList is None or len(self.ToolChainList) == 0:\r
                 EdkLogger.error("build", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.\n")\r
 \r
         # check if the tool chains are defined or not\r
@@ -935,7 +935,7 @@ class Build():
                 ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool])\r
         self.ToolChainFamily = ToolChainFamily\r
 \r
-        if self.ThreadNumber == None:\r
+        if self.ThreadNumber is None:\r
             self.ThreadNumber = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER]\r
             if self.ThreadNumber == '':\r
                 self.ThreadNumber = 0\r
@@ -1224,7 +1224,7 @@ class Build():
     #                                       for dependent modules/Libraries\r
     #\r
     def _BuildPa(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False, FfsCommand={}):\r
-        if AutoGenObject == None:\r
+        if AutoGenObject is None:\r
             return False\r
 \r
         # skip file generation for cleanxxx targets, run and fds target\r
@@ -1252,7 +1252,7 @@ class Build():
             EdkLogger.quiet("Building ... %s" % repr(AutoGenObject))\r
 \r
         BuildCommand = AutoGenObject.BuildCommand\r
-        if BuildCommand == None or len(BuildCommand) == 0:\r
+        if BuildCommand is None or len(BuildCommand) == 0:\r
             EdkLogger.error("build", OPTION_MISSING,\r
                             "No build command found for this module. "\r
                             "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %\r
@@ -1343,7 +1343,7 @@ class Build():
     #                                       for dependent modules/Libraries\r
     #\r
     def _Build(self, Target, AutoGenObject, CreateDepsCodeFile=True, CreateDepsMakeFile=True, BuildModule=False):\r
-        if AutoGenObject == None:\r
+        if AutoGenObject is None:\r
             return False\r
 \r
         # skip file generation for cleanxxx targets, run and fds target\r
@@ -1372,7 +1372,7 @@ class Build():
             EdkLogger.quiet("Building ... %s" % repr(AutoGenObject))\r
 \r
         BuildCommand = AutoGenObject.BuildCommand\r
-        if BuildCommand == None or len(BuildCommand) == 0:\r
+        if BuildCommand is None or len(BuildCommand) == 0:\r
             EdkLogger.error("build", OPTION_MISSING,\r
                             "No build command found for this module. "\r
                             "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." %\r
@@ -1536,7 +1536,7 @@ class Build():
                 FvMap.readline()\r
                 for Line in FvMap:\r
                     MatchGuid = GuidPattern.match(Line)\r
-                    if MatchGuid != None:\r
+                    if MatchGuid is not None:\r
                         #\r
                         # Replace GUID with module name\r
                         #\r
@@ -1548,7 +1548,7 @@ class Build():
                     # Add the debug image full path.\r
                     #\r
                     MatchGuid = GuidName.match(Line)\r
-                    if MatchGuid != None:\r
+                    if MatchGuid is not None:\r
                         GuidString = MatchGuid.group().split("=")[1]\r
                         if GuidString.upper() in ModuleList:\r
                             MapBuffer.write('(IMAGE=%s)\n' % (os.path.join(ModuleList[GuidString.upper()].DebugDir, ModuleList[GuidString.upper()].Name + '.efi')))\r
@@ -1758,7 +1758,7 @@ class Build():
                     for Module in Pa.Platform.Modules:\r
                         # Get ModuleAutoGen object to generate C code file and makefile\r
                         Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
-                        if Ma == None:\r
+                        if Ma is None:\r
                             continue\r
                         self.BuildModules.append(Ma)\r
                     self._BuildPa(self.Target, Pa, FfsCommand=CmdListDict)\r
@@ -1778,7 +1778,7 @@ class Build():
                     ModuleList = {}\r
                     for Pa in Wa.AutoGenObjectList:\r
                         for Ma in Pa.ModuleAutoGenList:\r
-                            if Ma == None:\r
+                            if Ma is None:\r
                                 continue\r
                             if not Ma.IsLibrary:\r
                                 ModuleList[Ma.Guid.upper()] = Ma\r
@@ -1856,7 +1856,7 @@ class Build():
                     for Module in Pa.Platform.Modules:\r
                         if self.ModuleFile.Dir == Module.Dir and self.ModuleFile.Name == Module.Name:\r
                             Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
-                            if Ma == None: continue\r
+                            if Ma is None: continue\r
                             MaList.append(Ma)\r
                             if Ma.CanSkipbyHash():\r
                                 self.HashSkipModules.append(Ma)\r
@@ -1936,7 +1936,7 @@ class Build():
                     ModuleList = {}\r
                     for Pa in Wa.AutoGenObjectList:\r
                         for Ma in Pa.ModuleAutoGenList:\r
-                            if Ma == None:\r
+                            if Ma is None:\r
                                 continue\r
                             if not Ma.IsLibrary:\r
                                 ModuleList[Ma.Guid.upper()] = Ma\r
@@ -2021,13 +2021,13 @@ class Build():
                     AutoGenStart = time.time()\r
                     GlobalData.gGlobalDefines['ARCH'] = Arch\r
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
-                    if Pa == None:\r
+                    if Pa is None:\r
                         continue\r
                     ModuleList = []\r
                     for Inf in Pa.Platform.Modules:\r
                         ModuleList.append(Inf)\r
                     # Add the INF only list in FDF\r
-                    if GlobalData.gFdfParser != None:\r
+                    if GlobalData.gFdfParser is not None:\r
                         for InfName in GlobalData.gFdfParser.Profile.InfList:\r
                             Inf = PathClass(NormPath(InfName), self.WorkspaceDir, Arch)\r
                             if Inf in Pa.Platform.Modules:\r
@@ -2037,7 +2037,7 @@ class Build():
                         # Get ModuleAutoGen object to generate C code file and makefile\r
                         Ma = ModuleAutoGen(Wa, Module, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
                         \r
-                        if Ma == None:\r
+                        if Ma is None:\r
                             continue\r
                         if Ma.CanSkipbyHash():\r
                             self.HashSkipModules.append(Ma)\r
@@ -2122,7 +2122,7 @@ class Build():
                     ModuleList = {}\r
                     for Pa in Wa.AutoGenObjectList:\r
                         for Ma in Pa.ModuleAutoGenList:\r
-                            if Ma == None:\r
+                            if Ma is None:\r
                                 continue\r
                             if not Ma.IsLibrary:\r
                                 ModuleList[Ma.Guid.upper()] = Ma\r
@@ -2263,18 +2263,18 @@ class Build():
         FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gFileTimeStampCache")\r
         if Utils.gFileTimeStampCache == {} and os.path.isfile(FilePath):\r
             Utils.gFileTimeStampCache = Utils.DataRestore(FilePath)\r
-            if Utils.gFileTimeStampCache == None:\r
+            if Utils.gFileTimeStampCache is None:\r
                 Utils.gFileTimeStampCache = {}\r
 \r
         FilePath = os.path.join(os.path.dirname(GlobalData.gDatabasePath), "gDependencyDatabase")\r
         if Utils.gDependencyDatabase == {} and os.path.isfile(FilePath):\r
             Utils.gDependencyDatabase = Utils.DataRestore(FilePath)\r
-            if Utils.gDependencyDatabase == None:\r
+            if Utils.gDependencyDatabase is None:\r
                 Utils.gDependencyDatabase = {}\r
 \r
 def ParseDefines(DefineList=[]):\r
     DefineDict = {}\r
-    if DefineList != None:\r
+    if DefineList is not None:\r
         for Define in DefineList:\r
             DefineTokenList = Define.split("=", 1)\r
             if not GlobalData.gMacroNamePattern.match(DefineTokenList[0]):\r
@@ -2403,16 +2403,16 @@ def Main():
     GlobalData.gCaseInsensitive = Option.CaseInsensitive\r
 \r
     # Set log level\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
 \r
-    if Option.LogFile != None:\r
+    if Option.LogFile is not None:\r
         EdkLogger.SetLogFile(Option.LogFile)\r
 \r
     if Option.WarningAsError == True:\r
@@ -2472,13 +2472,13 @@ def Main():
             if ErrorCode != 0:\r
                 EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
 \r
-        if Option.PlatformFile != None:\r
+        if Option.PlatformFile is not None:\r
             if os.path.isabs (Option.PlatformFile):\r
                 if os.path.normcase (os.path.normpath(Option.PlatformFile)).find (Workspace) == 0:\r
                     Option.PlatformFile = NormFile(os.path.normpath(Option.PlatformFile), Workspace)\r
             Option.PlatformFile = PathClass(Option.PlatformFile, Workspace)\r
 \r
-        if Option.FdfFile != None:\r
+        if Option.FdfFile is not None:\r
             if os.path.isabs (Option.FdfFile):\r
                 if os.path.normcase (os.path.normpath(Option.FdfFile)).find (Workspace) == 0:\r
                     Option.FdfFile = NormFile(os.path.normpath(Option.FdfFile), Workspace)\r
@@ -2487,7 +2487,7 @@ def Main():
             if ErrorCode != 0:\r
                 EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
 \r
-        if Option.Flag != None and Option.Flag not in ['-c', '-s']:\r
+        if Option.Flag is not None and Option.Flag not in ['-c', '-s']:\r
             EdkLogger.error("build", OPTION_VALUE_INVALID, "UNI flag must be one of -c or -s")\r
 \r
         MyBuild = Build(Target, Workspace, Option)\r
@@ -2504,35 +2504,35 @@ def Main():
         #\r
         BuildError = False\r
     except FatalError, X:\r
-        if MyBuild != None:\r
+        if MyBuild is not None:\r
             # for multi-thread build exits safely\r
             MyBuild.Relinquish()\r
-        if Option != None and Option.debug != None:\r
+        if Option is not None and Option.debug is not None:\r
             EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
         ReturnCode = X.args[0]\r
     except Warning, X:\r
         # error from Fdf parser\r
-        if MyBuild != None:\r
+        if MyBuild is not None:\r
             # for multi-thread build exits safely\r
             MyBuild.Relinquish()\r
-        if Option != None and Option.debug != None:\r
+        if Option is not None and Option.debug is not None:\r
             EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
         else:\r
             EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError=False)\r
         ReturnCode = FORMAT_INVALID\r
     except KeyboardInterrupt:\r
         ReturnCode = ABORT_ERROR\r
-        if Option != None and Option.debug != None:\r
+        if Option is not None and Option.debug is not None:\r
             EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
     except:\r
-        if MyBuild != None:\r
+        if MyBuild is not None:\r
             # for multi-thread build exits safely\r
             MyBuild.Relinquish()\r
 \r
         # try to get the meta-file from the object causing exception\r
         Tb = sys.exc_info()[-1]\r
         MetaFile = GlobalData.gProcessingFile\r
-        while Tb != None:\r
+        while Tb is not None:\r
             if 'self' in Tb.tb_frame.f_locals and hasattr(Tb.tb_frame.f_locals['self'], 'MetaFile'):\r
                 MetaFile = Tb.tb_frame.f_locals['self'].MetaFile\r
             Tb = Tb.tb_next\r
@@ -2566,7 +2566,7 @@ def Main():
         BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration) + ", %d day(s)" % (BuildDuration.tm_yday - 1)\r
     else:\r
         BuildDurationStr = time.strftime("%H:%M:%S", BuildDuration)\r
-    if MyBuild != None:\r
+    if MyBuild is not None:\r
         if not BuildError:\r
             MyBuild.BuildReport.GenerateReport(BuildDurationStr, LogBuildTime(MyBuild.AutoGenTime), LogBuildTime(MyBuild.MakeTime), LogBuildTime(MyBuild.GenFdsTime))\r
         MyBuild.Db.Close()\r