diff options
author | Hess Chen <hesheng.chen@intel.com> | 2014-08-26 05:58:02 +0000 |
---|---|---|
committer | hchen30 <hchen30@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-26 05:58:02 +0000 |
commit | 421ccda3079077dd613308526e02d797f5cc356a (patch) | |
tree | ecf0907550f140643cb5ab965fd3b87d837b8ee4 /BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py | |
parent | f0aa06e385c41743ac805bed9469aac336a6ec4c (diff) | |
download | edk2-platforms-421ccda3079077dd613308526e02d797f5cc356a.tar.xz |
This patch is going to:
1. Add a recovery mode for UPT failure
2. Add UNI file support
3. Add binary file header support
4. Add support for PCD error message
5. Add support for replace
6. Format generated INF/DEC files
7. Update dependency check
8. Other minor fixes
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15896 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py')
-rw-r--r-- | BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py index 4540fe2754..210f973f1a 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py @@ -1,7 +1,7 @@ ## @file
# This file contained the parser for [Libraries] sections in INF file
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -44,21 +44,21 @@ class InfLibrarySectionParser(InfParserSectionRoot): # Macro defined in this section
#
SectionMacros = {}
- ValueList = []
- LibraryList = []
- LibStillCommentFalg = False
- LibHeaderComments = []
- LibLineComment = None
+ ValueList = []
+ LibraryList = []
+ LibStillCommentFalg = False
+ LibHeaderComments = []
+ LibLineComment = None
#
# Parse section content
#
for Line in SectionString:
LibLineContent = Line[0]
- LibLineNo = Line[1]
-
+ LibLineNo = Line[1]
+
if LibLineContent.strip() == '':
continue
-
+
#
# Found Header Comments
#
@@ -82,14 +82,14 @@ class InfLibrarySectionParser(InfParserSectionRoot): continue
else:
LibStillCommentFalg = False
-
+
if len(LibHeaderComments) >= 1:
LibLineComment = InfLineCommentObject()
LineCommentContent = ''
for Item in LibHeaderComments:
LineCommentContent += Item[0] + DT.END_OF_LINE
LibLineComment.SetHeaderComments(LineCommentContent)
-
+
#
# Find Tail comment.
#
@@ -98,8 +98,8 @@ class InfLibrarySectionParser(InfParserSectionRoot): LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]
if LibLineComment == None:
LibLineComment = InfLineCommentObject()
- LibLineComment.SetTailComments(LibTailComments)
-
+ LibLineComment.SetTailComments(LibTailComments)
+
#
# Find Macro
#
@@ -110,28 +110,28 @@ class InfLibrarySectionParser(InfParserSectionRoot): if Name != None:
SectionMacros[Name] = Value
LibLineComment = None
- LibHeaderComments = []
+ LibHeaderComments = []
continue
-
+
TokenList = GetSplitValueList(LibLineContent, DT.TAB_VALUE_SPLIT, 1)
ValueList[0:len(TokenList)] = TokenList
-
+
#
# Replace with Local section Macro and [Defines] section Macro.
#
- ValueList = [InfExpandMacro(Value, (FileName, LibLineContent, LibLineNo),
+ ValueList = [InfExpandMacro(Value, (FileName, LibLineContent, LibLineNo),
self.FileLocalMacros, SectionMacros, True)
for Value in ValueList]
-
- LibraryList.append((ValueList, LibLineComment,
+
+ LibraryList.append((ValueList, LibLineComment,
(LibLineContent, LibLineNo, FileName)))
ValueList = []
LibLineComment = None
LibTailComments = ''
LibHeaderComments = []
-
+
continue
-
+
#
# Current section archs
#
@@ -139,36 +139,36 @@ class InfLibrarySectionParser(InfParserSectionRoot): for Item in self.LastSectionHeaderContent:
if (Item[1], Item[2]) not in KeyList:
KeyList.append((Item[1], Item[2]))
-
- if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList = KeyList):
- Logger.Error('InfParser',
+
+ if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList=KeyList):
+ Logger.Error('InfParser',
FORMAT_INVALID,
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Library]"),
- File=FileName,
+ File=FileName,
Line=Item[3])
#
# For Binary INF
#
else:
self.InfAsBuiltLibraryParser(SectionString, InfSectionObject, FileName)
-
+
def InfAsBuiltLibraryParser(self, SectionString, InfSectionObject, FileName):
LibraryList = []
LibInsFlag = False
for Line in SectionString:
LineContent = Line[0]
- LineNo = Line[1]
-
+ LineNo = Line[1]
+
if LineContent.strip() == '':
LibInsFlag = False
continue
-
+
if not LineContent.strip().startswith("#"):
- Logger.Error('InfParser',
+ Logger.Error('InfParser',
FORMAT_INVALID,
- ST.ERR_LIB_CONTATIN_ASBUILD_AND_COMMON,
- File=FileName,
- Line=LineNo,
+ ST.ERR_LIB_CONTATIN_ASBUILD_AND_COMMON,
+ File=FileName,
+ Line=LineNo,
ExtraData=LineContent)
if IsLibInstanceInfo(LineContent):
@@ -185,13 +185,6 @@ class InfLibrarySectionParser(InfParserSectionRoot): if LibGuid != '':
if (LibGuid, LibVer) not in LibraryList:
LibraryList.append((LibGuid, LibVer))
- else:
- Logger.Error('InfParser',
- FORMAT_INVALID,
- ST.ERR_LIB_INSTANCE_MISS_GUID,
- File=FileName,
- Line=LineNo,
- ExtraData=LineContent)
#
# Current section archs
@@ -201,10 +194,10 @@ class InfLibrarySectionParser(InfParserSectionRoot): for Item in self.LastSectionHeaderContent:
if (Item[1], Item[2]) not in KeyList:
KeyList.append((Item[1], Item[2]))
-
- if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList = KeyList):
- Logger.Error('InfParser',
+
+ if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList=KeyList):
+ Logger.Error('InfParser',
FORMAT_INVALID,
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Library]"),
- File=FileName,
- Line=Item[3])
\ No newline at end of file + File=FileName,
+ Line=Item[3])
|