From f7496d717357b9af78414d19679b073403812340 Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Thu, 5 Jul 2018 17:40:04 +0800 Subject: BaseTools: Clean up source files 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Yonghong Zhu Reviewed-by: Yonghong Zhu --- .../Python/UPT/Parser/InfBinarySectionParser.py | 124 ++++++++++----------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'BaseTools/Source/Python/UPT/Parser/InfBinarySectionParser.py') 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.
+# Copyright (c) 2011 - 2018, 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 -# 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]) + -- cgit v1.2.3