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