BaseTools: fix None comparisons

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>
This commit is contained in:
Carsey, Jaben
2018-04-13 08:02:10 +08:00
committed by Yonghong Zhu
parent 72fbe88d72
commit 128d435f5e
5 changed files with 9 additions and 10 deletions

View File

@ -1665,7 +1665,7 @@ class PlatformAutoGen(AutoGen):
DscPcdEntry.TokenValue = DecPcdEntry.TokenValue DscPcdEntry.TokenValue = DecPcdEntry.TokenValue
DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName] DscPcdEntry.TokenSpaceGuidValue = eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName]
# Only fix the value while no value provided in DSC file. # Only fix the value while no value provided in DSC file.
if (Sku.DefaultValue == "" or Sku.DefaultValue==None): if not Sku.DefaultValue:
DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue
if DscPcdEntry not in self._DynamicPcdList: if DscPcdEntry not in self._DynamicPcdList:

View File

@ -1540,7 +1540,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
} }
if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']: if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']:
if Info.SourceFileList <> None and Info.SourceFileList <> []: if Info.SourceFileList:
if NumEntryPoints != 1: if NumEntryPoints != 1:
EdkLogger.error( EdkLogger.error(
"build", "build",

View File

@ -337,11 +337,10 @@ class FV (FvClassObject):
# #
# Generate FV extension header file # Generate FV extension header file
# #
if self.FvNameGuid is None or self.FvNameGuid == '': if not self.FvNameGuid:
if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable: if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:
GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName)) GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
else:
if self.FvNameGuid <> None and self.FvNameGuid <> '':
TotalSize = 16 + 4 TotalSize = 16 + 4
Buffer = '' Buffer = ''
if self.UsedSizeEnable: if self.UsedSizeEnable:

View File

@ -9,7 +9,7 @@
# on STDOUT. # on STDOUT.
# This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013 # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013
# #
# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -89,7 +89,7 @@ if __name__ == '__main__':
# #
# Check for output file argument # Check for output file argument
# #
if args.OutputFile <> None: if args.OutputFile is not None:
for Item in args.OutputFile: for Item in args.OutputFile:
# #
# Save PEM filename and close output file # Save PEM filename and close output file
@ -109,7 +109,7 @@ if __name__ == '__main__':
# #
# Check for input file argument # Check for input file argument
# #
if args.InputFile <> None: if args.InputFile is not None:
for Item in args.InputFile: for Item in args.InputFile:
# #
# Save PEM filename and close input file # Save PEM filename and close input file

View File

@ -2292,7 +2292,7 @@ class DscBuildData(PlatformBuildClassObject):
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName] pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
# Only fix the value while no value provided in DSC file. # Only fix the value while no value provided in DSC file.
for sku in pcd.SkuInfoList.values(): for sku in pcd.SkuInfoList.values():
if (sku.DefaultValue == "" or sku.DefaultValue==None): if not sku.DefaultValue:
sku.DefaultValue = pcdDecObject.DefaultValue sku.DefaultValue = pcdDecObject.DefaultValue
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys(): if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
valuefromDec = pcdDecObject.DefaultValue valuefromDec = pcdDecObject.DefaultValue
@ -2624,7 +2624,7 @@ class DscBuildData(PlatformBuildClassObject):
pcd.DatumType = pcdDecObject.DatumType pcd.DatumType = pcdDecObject.DatumType
# Only fix the value while no value provided in DSC file. # Only fix the value while no value provided in DSC file.
for sku in pcd.SkuInfoList.values(): for sku in pcd.SkuInfoList.values():
if (sku.DefaultValue == "" or sku.DefaultValue==None): if not sku.DefaultValue:
sku.DefaultValue = pcdDecObject.DefaultValue sku.DefaultValue = pcdDecObject.DefaultValue
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys(): if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
valuefromDec = pcdDecObject.DefaultValue valuefromDec = pcdDecObject.DefaultValue