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.151; helo=mga17.intel.com; envelope-from=zhijux.fan@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 982AD21959CB2 for ; Fri, 25 Jan 2019 00:52:36 -0800 (PST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2019 00:52:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,520,1539673200"; d="dat'59?scan'59,208,59";a="314735580" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 25 Jan 2019 00:52:36 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 25 Jan 2019 00:52:35 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 25 Jan 2019 00:52:35 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.194]) with mapi id 14.03.0415.000; Fri, 25 Jan 2019 16:52:33 +0800 From: "Fan, ZhijuX" To: "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Feng, Bob C" Thread-Topic: [edk2][PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert Thread-Index: AdS0i054rztMziRtRTWSGBMZqaEbIg== Date: Fri, 25 Jan 2019 08:52:32 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [PATCH] BaseTools:Define Macro in Inf file, the pcdvalue Can't convert 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: Fri, 25 Jan 2019 08:52:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Define Macro in Inf file, the pcdvalue Can't convert in dec: gUefiOvmfPkgGuid.test1|"ddd"|VOID*|0x3c in inf: DEFINE ABC=3DPATH gUefiOvmfPkgTokenSpaceGuid.test1|$(ABC) Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 6df0d3cdf8..f31dbc2649 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -757,9 +757,13 @@ class InfParser(MetaFileParser): if self._ValueList[2] !=3D '': InfPcdValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE_= SPLIT, 1) if InfPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] =3D TokenList[1].replace(InfPcdValueLis= t[0], '1', 1); + self._ValueList[2] =3D TokenList[1].replace(InfPcdValueLis= t[0], '1', 1) elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] =3D TokenList[1].replace(InfPcdValueLis= t[0], '0', 1); + self._ValueList[2] =3D TokenList[1].replace(InfPcdValueLis= t[0], '0', 1) + elif isinstance(InfPcdValueList[0], str) and InfPcdValueList[0= ].find('$(') >=3D 0: + Value =3D ReplaceExprMacro(InfPcdValueList[0],self._Macros= ) + if Value !=3D '0': + self._ValueList[2] =3D Value if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict: self.PcdsDict[self._ValueList[0], self._ValueList[1]] =3D self= ._SectionType elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] !=3D se= lf._SectionType: --=20 2.14.1.windows.1