From nobody Sat May 4 03:47:40 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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 1497946135033739.7178283806413; Tue, 20 Jun 2017 01:08:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 075BD21BB2527; Tue, 20 Jun 2017 01:07:30 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 0D04821AE2639 for ; Tue, 20 Jun 2017 01:07:28 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 20 Jun 2017 01:08:50 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2017 01:08:49 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,364,1493708400"; d="scan'208";a="276350777" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Tue, 20 Jun 2017 16:04:47 +0800 Message-Id: <1497945887-876-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Fix the bug that use '|' or '||' in DSC file's Pcd value X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yunhua Feng , 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" From: Yunhua Feng Fix the bug to support use '|' or '||' in DSC file's Pcd value. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yunhua Feng Reviewed-by: Liming Gao --- BaseTools/Source/Python/Common/String.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Py= thon/Common/String.py index 5c8d1e0..81c053d 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -44,16 +44,17 @@ gHumanReadableVerPatt =3D re.compile(r'([1-9][0-9]*|0)\= .[0-9]{1,2}$') def GetSplitValueList(String, SplitTag=3DDataType.TAB_VALUE_SPLIT, MaxSpli= t=3D -1): ValueList =3D [] Last =3D 0 Escaped =3D False InString =3D False + InParenthesis =3D 0 for Index in range(0, len(String)): Char =3D String[Index] =20 if not Escaped: # Found a splitter not in a string, split it - if not InString and Char =3D=3D SplitTag: + if not InString and InParenthesis =3D=3D 0 and Char =3D=3D Spl= itTag: ValueList.append(String[Last:Index].strip()) Last =3D Index + 1 if MaxSplit > 0 and len(ValueList) >=3D MaxSplit: break =20 @@ -62,10 +63,14 @@ def GetSplitValueList(String, SplitTag=3DDataType.TAB_V= ALUE_SPLIT, MaxSplit=3D -1): elif Char =3D=3D '"': if not InString: InString =3D True else: InString =3D False + elif Char =3D=3D '(': + InParenthesis =3D InParenthesis + 1 + elif Char =3D=3D ')': + InParenthesis =3D InParenthesis - 1 else: Escaped =3D False =20 if Last < len(String): ValueList.append(String[Last:].strip()) --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel