From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org 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 EB3E121184E92 for ; Tue, 30 Oct 2018 20:51:29 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 20:51:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,447,1534834800"; d="scan'208";a="82253520" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 30 Oct 2018 20:51:29 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 20:51:29 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 20:51:28 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Wed, 31 Oct 2018 11:51:25 +0800 From: "Zhu, Yonghong" To: "Gao, Liming" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string Thread-Index: AQHUcGE4sqilAQF7UEmUGeVqwisV+6U4uDBg Date: Wed, 31 Oct 2018 03:51:24 +0000 Message-ID: References: <20181030145945.2780-1-liming.gao@intel.com> In-Reply-To: <20181030145945.2780-1-liming.gao@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 ConvertFceToStructurePcd: Fix the array value with empty string X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 03:51:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Gao, Liming=20 Sent: Tuesday, October 30, 2018 11:00 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value wi= th empty string Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Yonghong Zhu --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scri= pts/ConvertFceToStructurePcd.py index 6ca51c4..9240b8f 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -303,7 +303,10 @@ class Config(object): list1 =3D [t for t in list1 if t !=3D ''] # remove '' form list first_num =3D int(list1[0], 16) if list1[first_num + 1] =3D=3D 'STRING': # parser STRING - value =3D 'L%s' % list1[-1] + if list1[-1] =3D=3D '""': + value =3D "{0x0, 0x0}" + else: + value =3D 'L%s' % list1[-1] elif list1[first_num + 1] =3D=3D 'ORDERED_LIST': # parser ORDERED_LIS= T value_total =3D int(list1[first_num + 2]) list2 =3D list1[-value_total:] @@ -505,12 +508,22 @@ class mainprocess(object): inf_list =3D self.del_repeat(inf_list) header_list =3D self.plus(self.del_repeat(header_list)) title_all=3Dlist(set(title_list)) - info_list =3D self.del_repeat(info_list) + info_list =3D self.remove_bracket(self.del_repeat(info_list)) for i in range(len(info_list)-1,-1,-1): if len(info_list[i]) =3D=3D 0: info_list.remove(info_list[i]) return keys,title_all,info_list,header_list,inf_list =20 + def remove_bracket(self,List): + for i in List: + for j in i: + tmp =3D j.split("|") + if (('L"' in j) and ("[" in j)) or (tmp[1].strip() =3D=3D '{0x0, 0= x0}'): + tmp[0] =3D tmp[0][:tmp[0].index('[')] + List[List.index(i)][i.index(j)] =3D "|".join(tmp) + else: + List[List.index(i)][i.index(j)] =3D j + return List =20 def write_all(self): title_flag=3D1 --=20 2.10.0.windows.1