From nobody Tue Feb 10 13:00:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1523577738306963.6557855867696; Thu, 12 Apr 2018 17:02:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D8DEE226EAC6F; Thu, 12 Apr 2018 17:02:15 -0700 (PDT) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 73E2C226CD7BE for ; Thu, 12 Apr 2018 17:02:14 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 17:02:13 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga004.jf.intel.com with ESMTP; 12 Apr 2018 17:02:13 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,444,1517904000"; d="scan'208";a="191109782" From: Jaben To: edk2-devel@lists.01.org Date: Thu, 12 Apr 2018 17:02:10 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/2] BaseTools: fix None comparisons X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" when comparing a list/string against None and empty, just compare the objec= t. when comparing against None, dont use !=3D, =3D=3D, <> Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2= +- BaseTools/Source/Python/AutoGen/GenC.py | 2= +- BaseTools/Source/Python/GenFds/Fv.py | 5= ++--- BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | 6= +++--- BaseTools/Source/Python/Workspace/DscBuildData.py | 4= ++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index dbc9f893c2f1..2613c77a7a10 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1675,7 +1675,7 @@ class PlatformAutoGen(AutoGen): DscPcdEntry.TokenValue =3D Dec= PcdEntry.TokenValue DscPcdEntry.TokenSpaceGuidValu= e =3D eachDec.Guids[DecPcdEntry.TokenSpaceGuidCName] # Only fix the value while no = value provided in DSC file. - if (Sku.DefaultValue =3D=3D ""= or Sku.DefaultValue=3D=3DNone): + if not Sku.DefaultValue: DscPcdEntry.SkuInfoList[Ds= cPcdEntry.SkuInfoList.keys()[0]].DefaultValue =3D DecPcdEntry.DefaultValue = =20 if DscPcdEntry not in self._DynamicPcdList: diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 58da9e6b1784..a15eb707421e 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1534,7 +1534,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): } =20 if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_ST= ANDALONE']: - if Info.SourceFileList <> None and Info.SourceFileList <> []: + if Info.SourceFileList: if NumEntryPoints !=3D 1: EdkLogger.error( "build", diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python= /GenFds/Fv.py index 345ad3bdcc90..aae644bef905 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -337,11 +337,10 @@ class FV (FvClassObject): # # Generate FV extension header file # - if self.FvNameGuid is None or self.FvNameGuid =3D=3D '': + if not self.FvNameGuid: if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable: GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entr= ies declared for %s with no FvNameGuid declaration." % (self.UiFvName)) - =20 - if self.FvNameGuid <> None and self.FvNameGuid <> '': + else: TotalSize =3D 16 + 4 Buffer =3D '' if self.UsedSizeEnable: diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Generat= eKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateK= eys.py index 95a636966c59..9711de8f5c2e 100644 --- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py +++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py @@ -9,7 +9,7 @@ # on STDOUT. # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013 # -# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may b= e found at @@ -89,7 +89,7 @@ if __name__ =3D=3D '__main__': # # Check for output file argument # - if args.OutputFile <> None: + if args.OutputFile is not None: for Item in args.OutputFile: # # Save PEM filename and close output file @@ -109,7 +109,7 @@ if __name__ =3D=3D '__main__': # # Check for input file argument # - if args.InputFile <> None: + if args.InputFile is not None: for Item in args.InputFile: # # Save PEM filename and close input file diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 6766f059b0f7..9c77d6c50c27 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2292,7 +2292,7 @@ class DscBuildData(PlatformBuildClassObject): pcdDecObject =3D self._DecPcds[pcd.TokenCName, pcd.TokenSpaceG= uidCName] # Only fix the value while no value provided in DSC file. for sku in pcd.SkuInfoList.values(): - if (sku.DefaultValue =3D=3D "" or sku.DefaultValue=3D=3DNo= ne): + if not sku.DefaultValue: sku.DefaultValue =3D pcdDecObject.DefaultValue if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in= pcd.SkuInfoList.keys(): valuefromDec =3D pcdDecObject.DefaultValue @@ -2624,7 +2624,7 @@ class DscBuildData(PlatformBuildClassObject): pcd.DatumType =3D pcdDecObject.DatumType # Only fix the value while no value provided in DSC file. for sku in pcd.SkuInfoList.values(): - if (sku.DefaultValue =3D=3D "" or sku.DefaultValue=3D=3DNo= ne): + if not sku.DefaultValue: sku.DefaultValue =3D pcdDecObject.DefaultValue if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in= pcd.SkuInfoList.keys(): valuefromDec =3D pcdDecObject.DefaultValue --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel