]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: fix None comparisons
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Fri, 13 Apr 2018 00:02:10 +0000 (08:02 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 17 Apr 2018 12:49:32 +0000 (20:49 +0800)
when comparing a list/string against None and empty, just compare the object.
when comparing against None, dont use !=, ==, <>

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenC.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
BaseTools/Source/Python/Workspace/DscBuildData.py

index a4e36d1a2fb4f3a47157f932157d7a7e8a86f222..69c1ef4eba319436b3e1a86a72f44643f918b1f5 100644 (file)
@@ -1665,7 +1665,7 @@ class PlatformAutoGen(AutoGen):
                                             DscPcdEntry.TokenValue = DecPcdEntry.TokenValue\r
                                             DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName]\r
                                             # Only fix the value while no value provided in DSC file.\r
-                                            if (Sku.DefaultValue == "" or Sku.DefaultValue==None):\r
+                                            if not Sku.DefaultValue:\r
                                                 DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue\r
                                                                                                                     \r
                                 if DscPcdEntry not in self._DynamicPcdList:\r
index c11bbc5716f927e9ee22926a4953099fffe494da..6706629722fcc7581054059becaa7cd39baf498d 100644 (file)
@@ -1540,7 +1540,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
     }\r
 \r
     if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']:\r
-        if Info.SourceFileList <> None and Info.SourceFileList <> []:\r
+        if Info.SourceFileList:\r
           if NumEntryPoints != 1:\r
               EdkLogger.error(\r
                   "build",\r
index 345ad3bdcc90036d53f9af00893e4eac34ca156c..aae644bef9058d3a415b910584f236ca5705c41d 100644 (file)
@@ -337,11 +337,10 @@ class FV (FvClassObject):
         #\r
         # Generate FV extension header file\r
         #\r
-        if self.FvNameGuid is None or self.FvNameGuid == '':\r
+        if not 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
-        if self.FvNameGuid <> None and self.FvNameGuid <> '':\r
+        else:\r
             TotalSize = 16 + 4\r
             Buffer = ''\r
             if self.UsedSizeEnable:\r
index 95a636966c5932050c87d202d24810e79cae85e8..9711de8f5c2eb2d58ac255cca25ca9a9402b165b 100644 (file)
@@ -9,7 +9,7 @@
 # on STDOUT.\r
 # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013\r
 #\r
-# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -89,7 +89,7 @@ if __name__ == '__main__':
   #\r
   # Check for output file argument\r
   #\r
-  if args.OutputFile <> None:\r
+  if args.OutputFile is not None:\r
     for Item in args.OutputFile:\r
       #\r
       # Save PEM filename and close output file\r
@@ -109,7 +109,7 @@ if __name__ == '__main__':
   #\r
   # Check for input file argument\r
   #\r
-  if args.InputFile <> None:\r
+  if args.InputFile is not None:\r
     for Item in args.InputFile:\r
       #\r
       # Save PEM filename and close input file\r
index fcd3132860d5ba9a3d61be8488000864824e7599..7ffb825efa9a752e0a73f6515f9fa02b38d24233 100644 (file)
@@ -2292,7 +2292,7 @@ class DscBuildData(PlatformBuildClassObject):
             pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]\r
             # Only fix the value while no value provided in DSC file.\r
             for sku in pcd.SkuInfoList.values():\r
-                if (sku.DefaultValue == "" or sku.DefaultValue==None):\r
+                if not sku.DefaultValue:\r
                     sku.DefaultValue = pcdDecObject.DefaultValue\r
             if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():\r
                 valuefromDec = pcdDecObject.DefaultValue\r
@@ -2624,7 +2624,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.DefaultValue == "" or sku.DefaultValue==None):\r
+                if not sku.DefaultValue:\r
                     sku.DefaultValue = pcdDecObject.DefaultValue\r
             if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():\r
                 valuefromDec = pcdDecObject.DefaultValue\r