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