From 490433ab847cf318f31f73bbbc1a503ae47370a4 Mon Sep 17 00:00:00 2001 From: Hess Chen Date: Sat, 1 Apr 2017 13:33:05 +0800 Subject: [PATCH] BaseTools/UPT: Fix a parser issue Update the method to get PCD information and support empty section. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen Reviewed-by: Yonghong Zhu --- .../Source/Python/UPT/GenMetaFile/GenInfFile.py | 5 +++-- .../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 bb8a1206b1..a376f56fcf 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 0a8624c67f..3c6c9ee290 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.39.2