From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 B04FD21DFA7A8 for ; Fri, 31 Mar 2017 22:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491024790; x=1522560790; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bRas31rbxJ+pNHKbbAb4EkheQDcCO8bFag5i5C90MdA=; b=Iaxydm9osor9KXo1LASuyJhNPIDICkqiMfO79Vy4Jf2Zmxb9LZSmbs36 Vn2sV4qko/zdRYIj+1traBAembgghA==; Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Mar 2017 22:33:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,255,1486454400"; d="scan'208";a="1114236490" Received: from tiano01.ccr.corp.intel.com ([10.239.9.111]) by orsmga001.jf.intel.com with ESMTP; 31 Mar 2017 22:33:09 -0700 From: hesschen To: edk2-devel@lists.01.org Date: Sat, 1 Apr 2017 13:33:05 +0800 Message-Id: <1491024785-9388-3-git-send-email-hesheng.chen@intel.com> X-Mailer: git-send-email 2.7.2.windows.1 In-Reply-To: <1491024785-9388-1-git-send-email-hesheng.chen@intel.com> References: <1491024785-9388-1-git-send-email-hesheng.chen@intel.com> Subject: [patch 3/3] BaseTools/UPT: Fix a parser issue 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: Sat, 01 Apr 2017 05:33:10 -0000 Update the method to get PCD information and support empty section. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hesschen --- BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 5 +++-- BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py | 13 ++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py index bb8a120..a376f56 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py @@ -568,8 +568,9 @@ def GenUserExtensions(ModuleObject): if UserExtension.GetIdentifier() == 'Depex': continue Statement = UserExtension.GetStatement() - if not Statement: - continue +# Comment the code to support user extension without any statement just the section header in [] +# if not Statement: +# continue ArchList = UserExtension.GetSupArchList() for Index in xrange(0, len(ArchList)): ArchList[Index] = ConvertArchForInstall(ArchList[Index]) diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py index 0a8624c..3c6c9ee 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenMetaFileMisc.py @@ -2,7 +2,7 @@ # # This file contained the miscellaneous routines for GenMetaFile usage. # -# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -108,33 +108,28 @@ def ObtainPcdName(Packages, TokenSpaceGuidValue, Token): TokenSpaceGuidName = '' PcdCName = '' TokenSpaceGuidNameFound = False - PcdCNameFound = False # # Get TokenSpaceGuidCName from Guids section # for GuidKey in DecGuidsDict: GuidList = DecGuidsDict[GuidKey] - if TokenSpaceGuidNameFound: - break for GuidItem in GuidList: if TokenSpaceGuidValue.upper() == GuidItem.GuidString.upper(): TokenSpaceGuidName = GuidItem.GuidCName TokenSpaceGuidNameFound = True break - + if TokenSpaceGuidNameFound: + break # # Retrieve PcdCName from Pcds Section # for PcdKey in DecPcdsDict: PcdList = DecPcdsDict[PcdKey] - if PcdCNameFound: - return TokenSpaceGuidName, PcdCName for PcdItem in PcdList: if TokenSpaceGuidName == PcdItem.TokenSpaceGuidCName and Token == PcdItem.TokenValue: PcdCName = PcdItem.TokenCName - PcdCNameFound = True - break + return TokenSpaceGuidName, PcdCName return TokenSpaceGuidName, PcdCName -- 2.7.2.windows.1