From nobody Tue Feb 10 11:17:58 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 1522194187778124.94525586177906; Tue, 27 Mar 2018 16:43:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 70F60220C2A68; Tue, 27 Mar 2018 16:36:21 -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 D0F2021F85E65 for ; Tue, 27 Mar 2018 16:36:16 -0700 (PDT) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 16:42:52 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2018 16:42:52 -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,368,1517904000"; d="scan'208";a="28995261" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 27 Mar 2018 16:42:46 -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 3/4] BaseTools: move regular expression compile out of function call. 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" move to the root of the file and dont recompile. 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/Common/Expression.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 3f2b43118553..340c50ebe00f 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -41,6 +41,8 @@ ERR_EMPTY_EXPR =3D 'Empty expression is not allo= wed.' ERR_IN_OPERAND =3D 'Macro after IN operator can only be: $(FAMILY= ), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).' =20 __ValidString =3D re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$') +_ReLabel =3D re.compile('LABEL\((\w+)\)') +_ReOffset =3D re.compile('OFFSET_OF\((\w+)\)') =20 ## SplitString # Split string to list according double quote @@ -853,13 +855,11 @@ class ValueExpressionEx(ValueExpression): PcdValueList =3D SplitPcdValueString(PcdValue.stri= p()[1:-1]) LabelDict =3D {} NewPcdValueList =3D [] - ReLabel =3D re.compile('LABEL\((\w+)\)') - ReOffset =3D re.compile('OFFSET_OF\((\w+)\)') LabelOffset =3D 0 for Index, Item in enumerate(PcdValueList): # compute byte offset of every LABEL - LabelList =3D ReLabel.findall(Item) - Item =3D ReLabel.sub('', Item) + LabelList =3D _ReLabel.findall(Item) + Item =3D _ReLabel.sub('', Item) Item =3D Item.strip() if LabelList: for Label in LabelList: @@ -886,11 +886,11 @@ class ValueExpressionEx(ValueExpression): # for LABEL parse Item =3D Item.strip() try: - Item =3D ReLabel.sub('', Item) + Item =3D _ReLabel.sub('', Item) except: pass try: - OffsetList =3D ReOffset.findall(Item) + OffsetList =3D _ReOffset.findall(Item) except: pass for Offset in OffsetList: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel