From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 B8E4921A00ACB for ; Fri, 23 Jun 2017 01:11:00 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jun 2017 01:12:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,377,1493708400"; d="scan'208";a="102800740" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 23 Jun 2017 01:12:26 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Jun 2017 01:12:25 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Jun 2017 01:12:25 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Fri, 23 Jun 2017 16:12:23 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Feng, YunhuaX" Thread-Topic: [Patch] BaseTools: Fix the bug that use '|' or '||' in DSC file's Pcd value Thread-Index: AQHS6ZyFyJjrvHEHGEiiTatbzO39rKIyHaUA Date: Fri, 23 Jun 2017 08:12:23 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D74DF5C@shsmsx102.ccr.corp.intel.com> References: <1497945887-876-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1497945887-876-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Fri, 23 Jun 2017 08:11:00 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Zhu, Yonghong >Sent: Tuesday, June 20, 2017 4:05 PM >To: edk2-devel@lists.01.org >Cc: Feng, YunhuaX ; Gao, Liming > >Subject: [Patch] BaseTools: Fix the bug that use '|' or '||' in DSC file's= Pcd value > >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 >--- > 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/Python/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, MaxSpl= it=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] > > 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 Sp= litTag: > ValueList.append(String[Last:Index].strip()) > Last =3D Index + 1 > if MaxSplit > 0 and len(ValueList) >=3D MaxSplit: > break > >@@ -62,10 +63,14 @@ def GetSplitValueList(String, >SplitTag=3DDataType.TAB_VALUE_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 > > if Last < len(String): > ValueList.append(String[Last:].strip()) >-- >2.6.1.windows.1