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 <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -3,9 +3,9 @@
|
||||
#
|
||||
# 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,
|
||||
@ -49,24 +49,24 @@ from Parser.InfParserMisc import IsBinaryInf
|
||||
#
|
||||
def OpenInfFile(Filename):
|
||||
FileLinesList = []
|
||||
|
||||
|
||||
try:
|
||||
FInputfile = open(Filename, "rb", 0)
|
||||
try:
|
||||
FileLinesList = FInputfile.readlines()
|
||||
except BaseException:
|
||||
Logger.Error("InfParser",
|
||||
FILE_READ_FAILURE,
|
||||
Logger.Error("InfParser",
|
||||
FILE_READ_FAILURE,
|
||||
ST.ERR_FILE_OPEN_FAILURE,
|
||||
File=Filename)
|
||||
finally:
|
||||
FInputfile.close()
|
||||
except BaseException:
|
||||
Logger.Error("InfParser",
|
||||
FILE_READ_FAILURE,
|
||||
Logger.Error("InfParser",
|
||||
FILE_READ_FAILURE,
|
||||
ST.ERR_FILE_OPEN_FAILURE,
|
||||
File=Filename)
|
||||
|
||||
|
||||
return FileLinesList
|
||||
|
||||
## InfParser
|
||||
@ -74,20 +74,20 @@ def OpenInfFile(Filename):
|
||||
# This class defined the structure used in InfParser object
|
||||
#
|
||||
# @param InfObject: Inherited from InfSectionParser class
|
||||
# @param Filename: Input value for Filename of INF file, default is
|
||||
# @param Filename: Input value for Filename of INF file, default is
|
||||
# None
|
||||
# @param WorkspaceDir: Input value for current workspace directory,
|
||||
# @param WorkspaceDir: Input value for current workspace directory,
|
||||
# default is None
|
||||
#
|
||||
class InfParser(InfSectionParser):
|
||||
|
||||
def __init__(self, Filename = None, WorkspaceDir = None):
|
||||
|
||||
|
||||
#
|
||||
# Call parent class construct function
|
||||
#
|
||||
super(InfParser, self).__init__()
|
||||
|
||||
|
||||
self.WorkspaceDir = WorkspaceDir
|
||||
self.SupArchList = DT.ARCH_LIST
|
||||
self.EventList = []
|
||||
@ -107,7 +107,7 @@ class InfParser(InfSectionParser):
|
||||
# @param Filename: Input value for filename of INF file
|
||||
#
|
||||
def ParseInfFile(self, Filename):
|
||||
|
||||
|
||||
Filename = NormPath(Filename)
|
||||
(Path, Name) = os.path.split(Filename)
|
||||
self.FullPath = Filename
|
||||
@ -120,30 +120,30 @@ class InfParser(InfSectionParser):
|
||||
# Initialize common data
|
||||
#
|
||||
LineNo = 0
|
||||
CurrentSection = DT.MODEL_UNKNOWN
|
||||
CurrentSection = DT.MODEL_UNKNOWN
|
||||
SectionLines = []
|
||||
|
||||
|
||||
#
|
||||
# Flags
|
||||
#
|
||||
HeaderCommentStart = False
|
||||
HeaderCommentStart = False
|
||||
HeaderCommentEnd = False
|
||||
HeaderStarLineNo = -1
|
||||
BinaryHeaderCommentStart = False
|
||||
BinaryHeaderCommentStart = False
|
||||
BinaryHeaderCommentEnd = False
|
||||
BinaryHeaderStarLineNo = -1
|
||||
|
||||
|
||||
#
|
||||
# While Section ends. parse whole section contents.
|
||||
#
|
||||
NewSectionStartFlag = False
|
||||
FirstSectionStartFlag = False
|
||||
|
||||
|
||||
#
|
||||
# Parse file content
|
||||
#
|
||||
CommentBlock = []
|
||||
|
||||
|
||||
#
|
||||
# Variables for Event/Hob/BootMode
|
||||
#
|
||||
@ -151,44 +151,44 @@ class InfParser(InfSectionParser):
|
||||
self.HobList = []
|
||||
self.BootModeList = []
|
||||
SectionType = ''
|
||||
|
||||
|
||||
FileLinesList = OpenInfFile (Filename)
|
||||
|
||||
|
||||
#
|
||||
# One INF file can only has one [Defines] section.
|
||||
#
|
||||
DefineSectionParsedFlag = False
|
||||
|
||||
|
||||
#
|
||||
# Convert special characters in lines to space character.
|
||||
#
|
||||
FileLinesList = ConvertSpecialChar(FileLinesList)
|
||||
|
||||
|
||||
#
|
||||
# Process Line Extender
|
||||
#
|
||||
FileLinesList = ProcessLineExtender(FileLinesList)
|
||||
|
||||
|
||||
#
|
||||
# Process EdkI INF style comment if found
|
||||
#
|
||||
OrigLines = [Line for Line in FileLinesList]
|
||||
FileLinesList, EdkCommentStartPos = ProcessEdkComment(FileLinesList)
|
||||
|
||||
|
||||
#
|
||||
# Judge whether the INF file is Binary INF or not
|
||||
#
|
||||
if IsBinaryInf(FileLinesList):
|
||||
GlobalData.gIS_BINARY_INF = True
|
||||
|
||||
|
||||
InfSectionCommonDefObj = None
|
||||
|
||||
|
||||
for Line in FileLinesList:
|
||||
LineNo = LineNo + 1
|
||||
Line = Line.strip()
|
||||
if (LineNo < len(FileLinesList) - 1):
|
||||
NextLine = FileLinesList[LineNo].strip()
|
||||
|
||||
|
||||
#
|
||||
# blank line
|
||||
#
|
||||
@ -209,7 +209,7 @@ class InfParser(InfSectionParser):
|
||||
HeaderStarLineNo = LineNo
|
||||
SectionLines.append((Line, LineNo))
|
||||
HeaderCommentStart = True
|
||||
continue
|
||||
continue
|
||||
|
||||
#
|
||||
# Collect Header content.
|
||||
@ -225,11 +225,11 @@ class InfParser(InfSectionParser):
|
||||
if (Line.startswith(DT.TAB_SPECIAL_COMMENT) or not Line.strip().startswith("#")) and HeaderCommentStart \
|
||||
and not HeaderCommentEnd:
|
||||
HeaderCommentEnd = True
|
||||
BinaryHeaderCommentStart = False
|
||||
BinaryHeaderCommentStart = False
|
||||
BinaryHeaderCommentEnd = False
|
||||
HeaderCommentStart = False
|
||||
HeaderCommentStart = False
|
||||
if Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1:
|
||||
self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
|
||||
self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
|
||||
SectionLines = []
|
||||
else:
|
||||
SectionLines.append((Line, LineNo))
|
||||
@ -255,8 +255,8 @@ class InfParser(InfSectionParser):
|
||||
SectionLines.append((Line, LineNo))
|
||||
BinaryHeaderCommentStart = True
|
||||
HeaderCommentEnd = True
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
#
|
||||
# check whether there are more than one binary header exist
|
||||
#
|
||||
@ -266,7 +266,7 @@ class InfParser(InfSectionParser):
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_MULTIPLE_BINARYHEADER_EXIST,
|
||||
File=Filename)
|
||||
|
||||
|
||||
#
|
||||
# Collect Binary Header content.
|
||||
#
|
||||
@ -287,17 +287,17 @@ class InfParser(InfSectionParser):
|
||||
#
|
||||
self.InfHeaderParser(SectionLines, self.InfBinaryHeader, self.FileName, True)
|
||||
SectionLines = []
|
||||
BinaryHeaderCommentEnd = True
|
||||
continue
|
||||
BinaryHeaderCommentEnd = True
|
||||
continue
|
||||
#
|
||||
# Find a new section tab
|
||||
# Or at the last line of INF file,
|
||||
# Or at the last line of INF file,
|
||||
# need to process the last section.
|
||||
#
|
||||
LastSectionFalg = False
|
||||
if LineNo == len(FileLinesList):
|
||||
LastSectionFalg = True
|
||||
|
||||
|
||||
if Line.startswith(DT.TAB_COMMENT_SPLIT) and not Line.startswith(DT.TAB_SPECIAL_COMMENT):
|
||||
SectionLines.append((Line, LineNo))
|
||||
if not LastSectionFalg:
|
||||
@ -307,23 +307,23 @@ class InfParser(InfSectionParser):
|
||||
# Encountered a section. start with '[' and end with ']'
|
||||
#
|
||||
if (Line.startswith(DT.TAB_SECTION_START) and \
|
||||
Line.find(DT.TAB_SECTION_END) > -1) or LastSectionFalg:
|
||||
|
||||
HeaderCommentEnd = True
|
||||
BinaryHeaderCommentEnd = True
|
||||
|
||||
Line.find(DT.TAB_SECTION_END) > -1) or LastSectionFalg:
|
||||
|
||||
HeaderCommentEnd = True
|
||||
BinaryHeaderCommentEnd = True
|
||||
|
||||
if not LastSectionFalg:
|
||||
#
|
||||
# check to prevent '#' inside section header
|
||||
#
|
||||
HeaderContent = Line[1:Line.find(DT.TAB_SECTION_END)]
|
||||
if HeaderContent.find(DT.TAB_COMMENT_SPLIT) != -1:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_HEADER_INVALID,
|
||||
File=self.FullPath,
|
||||
Line=LineNo,
|
||||
ExtraData=Line)
|
||||
Line=LineNo,
|
||||
ExtraData=Line)
|
||||
|
||||
#
|
||||
# Keep last time section header content for section parser
|
||||
@ -339,7 +339,7 @@ class InfParser(InfSectionParser):
|
||||
if CommentIndex > -1:
|
||||
TailComments = Line[CommentIndex:]
|
||||
Line = Line[:CommentIndex]
|
||||
|
||||
|
||||
InfSectionCommonDefObj = InfSectionCommonDef()
|
||||
if TailComments != '':
|
||||
InfSectionCommonDefObj.SetTailComments(TailComments)
|
||||
@ -350,8 +350,8 @@ class InfParser(InfSectionParser):
|
||||
# Call section parser before section header parer to avoid encounter EDKI INF file
|
||||
#
|
||||
if CurrentSection == DT.MODEL_META_DATA_DEFINE:
|
||||
DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
|
||||
DefineSectionParsedFlag, SectionLines,
|
||||
DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
|
||||
DefineSectionParsedFlag, SectionLines,
|
||||
InfSectionCommonDefObj, LineNo)
|
||||
#
|
||||
# Compare the new section name with current
|
||||
@ -377,52 +377,52 @@ class InfParser(InfSectionParser):
|
||||
#
|
||||
# End of section content collect.
|
||||
# Parser the section content collected previously.
|
||||
#
|
||||
#
|
||||
if NewSectionStartFlag or LastSectionFalg:
|
||||
if CurrentSection != DT.MODEL_META_DATA_DEFINE or \
|
||||
(LastSectionFalg and CurrentSection == DT.MODEL_META_DATA_DEFINE):
|
||||
DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
|
||||
DefineSectionParsedFlag, SectionLines,
|
||||
(LastSectionFalg and CurrentSection == DT.MODEL_META_DATA_DEFINE):
|
||||
DefineSectionParsedFlag = self._CallSectionParsers(CurrentSection,
|
||||
DefineSectionParsedFlag, SectionLines,
|
||||
InfSectionCommonDefObj, LineNo)
|
||||
|
||||
|
||||
CurrentSection = SectionType
|
||||
#
|
||||
# Clear section lines
|
||||
#
|
||||
SectionLines = []
|
||||
|
||||
SectionLines = []
|
||||
|
||||
if HeaderStarLineNo == -1:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_NO_SOURCE_HEADER,
|
||||
File=self.FullPath)
|
||||
File=self.FullPath)
|
||||
if BinaryHeaderStarLineNo > -1 and HeaderStarLineNo > -1 and HeaderStarLineNo > BinaryHeaderStarLineNo:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_BINARY_HEADER_ORDER,
|
||||
File=self.FullPath)
|
||||
File=self.FullPath)
|
||||
#
|
||||
# EDKII INF should not have EDKI style comment
|
||||
#
|
||||
if EdkCommentStartPos != -1:
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII,
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII,
|
||||
File=self.FullPath,
|
||||
Line=EdkCommentStartPos + 1,
|
||||
ExtraData=OrigLines[EdkCommentStartPos])
|
||||
|
||||
|
||||
#
|
||||
# extract [Event] [Hob] [BootMode] sections
|
||||
#
|
||||
# extract [Event] [Hob] [BootMode] sections
|
||||
#
|
||||
self._ExtractEventHobBootMod(FileLinesList)
|
||||
|
||||
|
||||
## _CheckSectionHeaders
|
||||
#
|
||||
#
|
||||
def _CheckSectionHeaders(self, Line, LineNo):
|
||||
if len(self.SectionHeaderContent) == 0:
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_HEADER_INVALID,
|
||||
File=self.FullPath,
|
||||
@ -431,7 +431,7 @@ class InfParser(InfSectionParser):
|
||||
for SectionItem in self.SectionHeaderContent:
|
||||
ArchList = []
|
||||
#
|
||||
# Not cover Depex/UserExtension section header
|
||||
# Not cover Depex/UserExtension section header
|
||||
# check.
|
||||
#
|
||||
if SectionItem[0].strip().upper() == DT.TAB_INF_FIXED_PCD.upper() or \
|
||||
@ -442,15 +442,15 @@ class InfParser(InfSectionParser):
|
||||
ArchList = GetSplitValueList(SectionItem[1].strip(), ' ')
|
||||
else:
|
||||
ArchList = [SectionItem[1].strip()]
|
||||
|
||||
|
||||
for Arch in ArchList:
|
||||
if (not IsValidArch(Arch)) and \
|
||||
(SectionItem[0].strip().upper() != DT.TAB_DEPEX.upper()) and \
|
||||
(SectionItem[0].strip().upper() != DT.TAB_USER_EXTENSIONS.upper()) and \
|
||||
(SectionItem[0].strip().upper() != DT.TAB_COMMON_DEFINES.upper()):
|
||||
Logger.Error("InfParser",
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[1]),
|
||||
ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[1]),
|
||||
File=self.FullPath,
|
||||
Line=LineNo, ExtraData=Line)
|
||||
#
|
||||
@ -467,11 +467,11 @@ class InfParser(InfSectionParser):
|
||||
ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(SectionItem[2]),
|
||||
File=self.FullPath, Line=LineNo,
|
||||
ExtraData=Line)
|
||||
|
||||
|
||||
## _CallSectionParsers
|
||||
#
|
||||
#
|
||||
def _CallSectionParsers(self, CurrentSection, DefineSectionParsedFlag,
|
||||
def _CallSectionParsers(self, CurrentSection, DefineSectionParsedFlag,
|
||||
SectionLines, InfSectionCommonDefObj, LineNo):
|
||||
if CurrentSection == DT.MODEL_META_DATA_DEFINE:
|
||||
if not DefineSectionParsedFlag:
|
||||
@ -481,22 +481,22 @@ class InfParser(InfSectionParser):
|
||||
InfSectionCommonDefObj)
|
||||
DefineSectionParsedFlag = True
|
||||
else:
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_MULTI_DEFINE_SECTION,
|
||||
File=self.FullPath,
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_MULTI_DEFINE_SECTION,
|
||||
File=self.FullPath,
|
||||
RaiseError = Logger.IS_RAISE_ERROR)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_META_DATA_BUILD_OPTION:
|
||||
self.InfBuildOptionParser(SectionLines,
|
||||
self.InfBuildOptionSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_LIBRARY_CLASS:
|
||||
self.InfLibraryParser(SectionLines,
|
||||
self.InfLibraryClassSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_META_DATA_PACKAGE:
|
||||
self.InfPackageParser(SectionLines,
|
||||
self.InfPackageSection,
|
||||
@ -512,37 +512,37 @@ class InfParser(InfSectionParser):
|
||||
self.InfPcdParser(SectionLines,
|
||||
self.InfPcdSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_SOURCE_FILE:
|
||||
self.InfSourceParser(SectionLines,
|
||||
self.InfSourcesSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_META_DATA_USER_EXTENSION:
|
||||
self.InfUserExtensionParser(SectionLines,
|
||||
self.InfUserExtensionSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_PROTOCOL:
|
||||
self.InfProtocolParser(SectionLines,
|
||||
self.InfProtocolSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_PPI:
|
||||
self.InfPpiParser(SectionLines,
|
||||
self.InfPpiSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_GUID:
|
||||
self.InfGuidParser(SectionLines,
|
||||
self.InfGuidSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_DEPEX:
|
||||
self.InfDepexParser(SectionLines,
|
||||
self.InfDepexSection,
|
||||
self.FullPath)
|
||||
|
||||
|
||||
elif CurrentSection == DT.MODEL_EFI_BINARY_FILE:
|
||||
self.InfBinaryParser(SectionLines,
|
||||
self.InfBinariesSection,
|
||||
@ -552,20 +552,20 @@ class InfParser(InfSectionParser):
|
||||
#
|
||||
else:
|
||||
if len(self.SectionHeaderContent) >= 1:
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_UNKNOWN_SECTION,
|
||||
File=self.FullPath, Line=LineNo,
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_UNKNOWN_SECTION,
|
||||
File=self.FullPath, Line=LineNo,
|
||||
RaiseError = Logger.IS_RAISE_ERROR)
|
||||
else:
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_NO_SECTION_ERROR,
|
||||
File=self.FullPath, Line=LineNo,
|
||||
Logger.Error("Parser",
|
||||
PARSER_ERROR,
|
||||
ST.ERR_INF_PARSER_NO_SECTION_ERROR,
|
||||
File=self.FullPath, Line=LineNo,
|
||||
RaiseError = Logger.IS_RAISE_ERROR)
|
||||
|
||||
return DefineSectionParsedFlag
|
||||
|
||||
|
||||
return DefineSectionParsedFlag
|
||||
|
||||
def _ExtractEventHobBootMod(self, FileLinesList):
|
||||
SpecialSectionStart = False
|
||||
CheckLocation = False
|
||||
@ -607,43 +607,43 @@ class InfParser(InfSectionParser):
|
||||
elif not Line:
|
||||
SpecialSectionStart = False
|
||||
CheckLocation = True
|
||||
Element = []
|
||||
Element = []
|
||||
else:
|
||||
if not Line.startswith(DT.TAB_COMMENT_SPLIT):
|
||||
Logger.Warn("Parser",
|
||||
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
|
||||
Logger.Warn("Parser",
|
||||
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
|
||||
File=self.FullPath, Line=LineNum)
|
||||
SpecialSectionStart = False
|
||||
CheckLocation = False
|
||||
Element = []
|
||||
else:
|
||||
Element.append([Line, LineNum])
|
||||
Element.append([Line, LineNum])
|
||||
else:
|
||||
if CheckLocation:
|
||||
if MatchObject:
|
||||
CheckLocation = False
|
||||
elif Line:
|
||||
Logger.Warn("Parser",
|
||||
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
|
||||
File=self.FullPath, Line=LineNum)
|
||||
Logger.Warn("Parser",
|
||||
ST.WARN_SPECIAL_SECTION_LOCATION_WRONG,
|
||||
File=self.FullPath, Line=LineNum)
|
||||
CheckLocation = False
|
||||
|
||||
|
||||
if len(self.BootModeList) >= 1:
|
||||
self.InfSpecialCommentParser(self.BootModeList,
|
||||
self.InfSpecialCommentSection,
|
||||
self.FileName,
|
||||
DT.TYPE_BOOTMODE_SECTION)
|
||||
|
||||
if len(self.EventList) >= 1:
|
||||
self.InfSpecialCommentParser(self.EventList,
|
||||
self.InfSpecialCommentParser(self.BootModeList,
|
||||
self.InfSpecialCommentSection,
|
||||
self.FileName,
|
||||
self.FileName,
|
||||
DT.TYPE_BOOTMODE_SECTION)
|
||||
|
||||
if len(self.EventList) >= 1:
|
||||
self.InfSpecialCommentParser(self.EventList,
|
||||
self.InfSpecialCommentSection,
|
||||
self.FileName,
|
||||
DT.TYPE_EVENT_SECTION)
|
||||
|
||||
|
||||
if len(self.HobList) >= 1:
|
||||
self.InfSpecialCommentParser(self.HobList,
|
||||
self.InfSpecialCommentSection,
|
||||
self.FileName,
|
||||
self.InfSpecialCommentParser(self.HobList,
|
||||
self.InfSpecialCommentSection,
|
||||
self.FileName,
|
||||
DT.TYPE_HOB_SECTION)
|
||||
## _ProcessLastSection
|
||||
#
|
||||
@ -652,35 +652,35 @@ class InfParser(InfSectionParser):
|
||||
#
|
||||
# The last line is a section header. will discard it.
|
||||
#
|
||||
if not (Line.startswith(DT.TAB_SECTION_START) and Line.find(DT.TAB_SECTION_END) > -1):
|
||||
if not (Line.startswith(DT.TAB_SECTION_START) and Line.find(DT.TAB_SECTION_END) > -1):
|
||||
SectionLines.append((Line, LineNo))
|
||||
|
||||
|
||||
if len(self.SectionHeaderContent) >= 1:
|
||||
TemSectionName = self.SectionHeaderContent[0][0].upper()
|
||||
if TemSectionName.upper() not in gINF_SECTION_DEF.keys():
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_UNKNOWN_SECTION,
|
||||
File=self.FullPath,
|
||||
Line=LineNo,
|
||||
Logger.Error("InfParser",
|
||||
FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_UNKNOWN_SECTION,
|
||||
File=self.FullPath,
|
||||
Line=LineNo,
|
||||
ExtraData=Line,
|
||||
RaiseError = Logger.IS_RAISE_ERROR
|
||||
)
|
||||
)
|
||||
else:
|
||||
CurrentSection = gINF_SECTION_DEF[TemSectionName]
|
||||
self.LastSectionHeaderContent = self.SectionHeaderContent
|
||||
|
||||
|
||||
return SectionLines, CurrentSection
|
||||
|
||||
## _ConvertSecNameToType
|
||||
#
|
||||
#
|
||||
def _ConvertSecNameToType(SectionName):
|
||||
def _ConvertSecNameToType(SectionName):
|
||||
SectionType = ''
|
||||
if SectionName.upper() not in gINF_SECTION_DEF.keys():
|
||||
SectionType = DT.MODEL_UNKNOWN
|
||||
SectionType = DT.MODEL_UNKNOWN
|
||||
else:
|
||||
SectionType = gINF_SECTION_DEF[SectionName.upper()]
|
||||
|
||||
return SectionType
|
||||
|
||||
SectionType = gINF_SECTION_DEF[SectionName.upper()]
|
||||
|
||||
return SectionType
|
||||
|
||||
|
Reference in New Issue
Block a user