]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/InfBuildData.py
BaseTools: Remove equality operator with None
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / InfBuildData.py
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