From nobody Fri Nov 1 04:33:59 2024 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 1522970087524293.18654027689763; Thu, 5 Apr 2018 16:14:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 852D922685245; Thu, 5 Apr 2018 16:14:11 -0700 (PDT) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 09FCF226FAA78 for ; Thu, 5 Apr 2018 16:14:08 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2018 16:14:06 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.141]) by orsmga004.jf.intel.com with ESMTP; 05 Apr 2018 16:14:05 -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=134.134.136.100; helo=mga07.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,412,1517904000"; d="scan'208";a="189047104" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Thu, 5 Apr 2018 16:13:57 -0700 Message-Id: <4ffa5d10e2c57cd22406b5f0a1ad5b509560a967.1522969978.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 09/14] BaseTools: optimize buildoptions loop 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" change a dict to a double defaultdict to prevent needing to seed innter val= ues. move "Value" determination under a conditional continue statement Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 21 ++++++-------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index cc08baacfae5..74828fdb62ef 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2698,40 +2698,31 @@ class PlatformAutoGen(AutoGen): AllTools =3D set(ModuleOptions.keys() + PlatformOptions.keys() + PlatformModuleOptions.keys() + ModuleTypeOptions.ke= ys() + self.ToolDefinition.keys()) - BuildOptions =3D {} + BuildOptions =3D defaultdict(lambda: defaultdict(str)) for Tool in AllTools: - if Tool not in BuildOptions: - BuildOptions[Tool] =3D {} - for Options in [self.ToolDefinition, ModuleOptions, PlatformOp= tions, ModuleTypeOptions, PlatformModuleOptions]: if Tool not in Options: continue for Attr in Options[Tool]: - Value =3D Options[Tool][Attr] # # Do not generate it in Makefile # if Attr =3D=3D TAB_TOD_DEFINES_BUILDRULEORDER: continue - if Attr not in BuildOptions[Tool]: - BuildOptions[Tool][Attr] =3D "" + Value =3D Options[Tool][Attr] # check if override is indicated if Value.startswith('=3D'): - ToolPath =3D Value[1:] - ToolPath =3D mws.handleWsMacro(ToolPath) - BuildOptions[Tool][Attr] =3D ToolPath + BuildOptions[Tool][Attr] =3D mws.handleWsMacro(Val= ue[1:]) else: - Value =3D mws.handleWsMacro(Value) if Attr !=3D 'PATH': - BuildOptions[Tool][Attr] +=3D " " + Value + BuildOptions[Tool][Attr] +=3D " " + mws.handle= WsMacro(Value) else: - BuildOptions[Tool][Attr] =3D Value + BuildOptions[Tool][Attr] =3D mws.handleWsMacro= (Value) + if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag i= s not None: # # Override UNI flag only for EDK module. # - if 'BUILD' not in BuildOptions: - BuildOptions['BUILD'] =3D {} BuildOptions['BUILD']['FLAGS'] =3D self.Workspace.UniFlag return BuildOptions, BuildRuleOrder =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel