diff options
Diffstat (limited to 'BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py')
-rw-r--r-- | BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py b/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py index f220402cb5..43cdeee3a7 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py @@ -1,11 +1,11 @@ ## @file
-# This file contained the parser for [Binaries] sections in INF file
+# This file contained the parser for [Binaries] sections in INF file
#
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2018, 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
-# distribution. The full text of the license may be found at
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@@ -35,7 +35,7 @@ class InfBinarySectionParser(InfParserSectionRoot): #
def InfBinaryParser(self, SectionString, InfSectionObject, FileName):
#
- # Macro defined in this section
+ # Macro defined in this section
#
SectionMacros = {}
ValueList = []
@@ -56,8 +56,8 @@ class InfBinarySectionParser(InfParserSectionRoot): StillCommentFalg = False
HeaderComments = []
- LineComment = None
-
+ LineComment = None
+
AllSectionContent = ''
#
# Parse section content
@@ -65,16 +65,16 @@ class InfBinarySectionParser(InfParserSectionRoot): for Line in SectionString:
BinLineContent = Line[0]
BinLineNo = Line[1]
-
+
if BinLineContent.strip() == '':
continue
-
+
CurrentLineObj = CurrentLine()
CurrentLineObj.FileName = FileName
CurrentLineObj.LineString = BinLineContent
CurrentLineObj.LineNo = BinLineNo
#
- # Found Header Comments
+ # Found Header Comments
#
if BinLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
#
@@ -85,7 +85,7 @@ class InfBinarySectionParser(InfParserSectionRoot): AllSectionContent += BinLineContent + DT.END_OF_LINE
continue
#
- # First time encounter comment
+ # First time encounter comment
#
else:
#
@@ -98,14 +98,14 @@ class InfBinarySectionParser(InfParserSectionRoot): continue
else:
StillCommentFalg = False
-
+
if len(HeaderComments) >= 1:
LineComment = InfLineCommentObject()
LineCommentContent = ''
for Item in HeaderComments:
LineCommentContent += Item[0] + DT.END_OF_LINE
LineComment.SetHeaderComments(LineCommentContent)
-
+
#
# Find Tail comment.
#
@@ -114,8 +114,8 @@ class InfBinarySectionParser(InfParserSectionRoot): BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]
if LineComment is None:
LineComment = InfLineCommentObject()
- LineComment.SetTailComments(TailComments)
-
+ LineComment.SetTailComments(TailComments)
+
#
# Find Macro
#
@@ -126,22 +126,22 @@ class InfBinarySectionParser(InfParserSectionRoot): if MacroDef[0] is not None:
SectionMacros[MacroDef[0]] = MacroDef[1]
LineComment = None
- HeaderComments = []
+ HeaderComments = []
continue
-
+
#
# Replace with Local section Macro and [Defines] section Macro.
- #
- LineContent = InfExpandMacro(BinLineContent,
- (FileName, BinLineContent, BinLineNo),
- self.FileLocalMacros,
+ #
+ LineContent = InfExpandMacro(BinLineContent,
+ (FileName, BinLineContent, BinLineNo),
+ self.FileLocalMacros,
SectionMacros, True)
-
- AllSectionContent += LineContent + DT.END_OF_LINE
+
+ AllSectionContent += LineContent + DT.END_OF_LINE
TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
ValueList[0:len(TokenList)] = TokenList
-
- #
+
+ #
# Should equal to UI/SEC_UI/UNI_UI
#
ValueList[0] = ValueList[0].strip()
@@ -149,84 +149,84 @@ class InfBinarySectionParser(InfParserSectionRoot): ValueList[0] == DT.BINARY_FILE_TYPE_SEC_UI or \
ValueList[0] == DT.BINARY_FILE_TYPE_UI:
if len(ValueList) == 2:
- TokenList = GetSplitValueList(ValueList[1],
- DT.TAB_VALUE_SPLIT,
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
2)
NewValueList = []
NewValueList.append(ValueList[0])
for Item in TokenList:
NewValueList.append(Item)
- UiBinaryList.append((NewValueList,
- LineComment,
- CurrentLineObj))
- #
+ UiBinaryList.append((NewValueList,
+ LineComment,
+ CurrentLineObj))
+ #
# Should equal to VER/SEC_VER/UNI_VER
#
elif ValueList[0] == DT.BINARY_FILE_TYPE_UNI_VER or \
ValueList[0] == DT.BINARY_FILE_TYPE_SEC_VER or \
ValueList[0] == DT.BINARY_FILE_TYPE_VER:
if len(ValueList) == 2:
- TokenList = GetSplitValueList(ValueList[1],
- DT.TAB_VALUE_SPLIT,
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
2)
NewValueList = []
NewValueList.append(ValueList[0])
for Item in TokenList:
- NewValueList.append(Item)
- VerBinaryList.append((NewValueList,
- LineComment,
+ NewValueList.append(Item)
+ VerBinaryList.append((NewValueList,
+ LineComment,
CurrentLineObj))
else:
if len(ValueList) == 2:
if ValueList[0].strip() == 'SUBTYPE_GUID':
- TokenList = GetSplitValueList(ValueList[1],
- DT.TAB_VALUE_SPLIT,
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
5)
else:
- TokenList = GetSplitValueList(ValueList[1],
- DT.TAB_VALUE_SPLIT,
+ TokenList = GetSplitValueList(ValueList[1],
+ DT.TAB_VALUE_SPLIT,
4)
-
+
NewValueList = []
NewValueList.append(ValueList[0])
for Item in TokenList:
- NewValueList.append(Item)
- ComBinaryList.append((NewValueList,
- LineComment,
+ NewValueList.append(Item)
+ ComBinaryList.append((NewValueList,
+ LineComment,
CurrentLineObj))
elif len(ValueList) == 1:
NewValueList = []
NewValueList.append(ValueList[0])
- ComBinaryList.append((NewValueList,
- LineComment,
+ ComBinaryList.append((NewValueList,
+ LineComment,
CurrentLineObj))
-
-
-
-
+
+
+
+
ValueList = []
LineComment = None
TailComments = ''
- HeaderComments = []
+ HeaderComments = []
continue
#
# Current section archs
- #
+ #
ArchList = []
for Item in self.LastSectionHeaderContent:
if Item[1] not in ArchList:
- ArchList.append(Item[1])
+ ArchList.append(Item[1])
InfSectionObject.SetSupArchList(Item[1])
-
- InfSectionObject.SetAllContent(AllSectionContent)
- if not InfSectionObject.SetBinary(UiBinaryList,
- VerBinaryList,
- ComBinaryList,
+
+ InfSectionObject.SetAllContent(AllSectionContent)
+ if not InfSectionObject.SetBinary(UiBinaryList,
+ VerBinaryList,
+ ComBinaryList,
ArchList):
- Logger.Error('InfParser',
+ Logger.Error('InfParser',
FORMAT_INVALID,
ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR%("[Binaries]"),
File=FileName,
- Line=Item[3])
-
\ No newline at end of file + Line=Item[3])
+
|