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:
@ -1,11 +1,11 @@
|
||||
## @file
|
||||
# This file contained the miscellaneous functions for INF parser
|
||||
# This file contained the miscellaneous functions for INF parser
|
||||
#
|
||||
# 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,
|
||||
@ -59,39 +59,39 @@ gINF_SECTION_DEF = {
|
||||
#
|
||||
# EDK1 section
|
||||
# TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE
|
||||
#
|
||||
#
|
||||
}
|
||||
|
||||
## InfExpandMacro
|
||||
#
|
||||
# Expand MACRO definition with MACROs defined in [Defines] section and specific section.
|
||||
# Expand MACRO definition with MACROs defined in [Defines] section and specific section.
|
||||
# The MACROs defined in specific section has high priority and will be expanded firstly.
|
||||
#
|
||||
# @param LineInfo Contain information of FileName, LineContent, LineNo
|
||||
# @param GlobalMacros MACROs defined in INF [Defines] section
|
||||
# @param SectionMacros MACROs defined in INF specific section
|
||||
# @param Flag If the flag set to True, need to skip macros in a quoted string
|
||||
# @param Flag If the flag set to True, need to skip macros in a quoted string
|
||||
#
|
||||
def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):
|
||||
if GlobalMacros is None:
|
||||
GlobalMacros = {}
|
||||
if SectionMacros is None:
|
||||
SectionMacros = {}
|
||||
|
||||
|
||||
FileName = LineInfo[0]
|
||||
LineContent = LineInfo[1]
|
||||
LineNo = LineInfo[2]
|
||||
|
||||
|
||||
# Don't expand macros in comments
|
||||
if LineContent.strip().startswith("#"):
|
||||
return Content
|
||||
|
||||
NewLineInfo = (FileName, LineNo, LineContent)
|
||||
|
||||
|
||||
#
|
||||
# First, replace MARCOs with value defined in specific section
|
||||
#
|
||||
Content = ReplaceMacro (Content,
|
||||
Content = ReplaceMacro (Content,
|
||||
SectionMacros,
|
||||
False,
|
||||
(LineContent, LineNo),
|
||||
@ -100,13 +100,13 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
|
||||
#
|
||||
# Then replace MARCOs with value defined in [Defines] section
|
||||
#
|
||||
Content = ReplaceMacro (Content,
|
||||
Content = ReplaceMacro (Content,
|
||||
GlobalMacros,
|
||||
False,
|
||||
(LineContent, LineNo),
|
||||
FileName,
|
||||
Flag)
|
||||
|
||||
|
||||
MacroUsed = gMACRO_PATTERN.findall(Content)
|
||||
#
|
||||
# no macro found in String, stop replacing
|
||||
@ -122,9 +122,9 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
|
||||
#
|
||||
ErrorInInf (ERR_MARCO_DEFINITION_MISS_ERROR,
|
||||
LineInfo=NewLineInfo)
|
||||
|
||||
|
||||
return Content
|
||||
|
||||
|
||||
|
||||
## IsBinaryInf
|
||||
#
|
||||
@ -135,25 +135,25 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
|
||||
def IsBinaryInf(FileLineList):
|
||||
if not FileLineList:
|
||||
return False
|
||||
|
||||
|
||||
ReIsSourcesSection = re.compile("^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
|
||||
ReIsBinarySection = re.compile("^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
|
||||
BinarySectionFoundFlag = False
|
||||
|
||||
|
||||
for Line in FileLineList:
|
||||
if ReIsSourcesSection.match(Line):
|
||||
return False
|
||||
if ReIsBinarySection.match(Line):
|
||||
BinarySectionFoundFlag = True
|
||||
|
||||
|
||||
if BinarySectionFoundFlag:
|
||||
return True
|
||||
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
## IsLibInstanceInfo
|
||||
#
|
||||
#
|
||||
# Judge whether the string contain the information of ## @LIB_INSTANCES.
|
||||
#
|
||||
# @param String
|
||||
@ -166,10 +166,10 @@ def IsLibInstanceInfo(String):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
## IsAsBuildOptionInfo
|
||||
#
|
||||
#
|
||||
# Judge whether the string contain the information of ## @ASBUILD.
|
||||
#
|
||||
# @param String
|
||||
@ -181,8 +181,8 @@ def IsAsBuildOptionInfo(String):
|
||||
if ReIsAsBuildInstance.match(String):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class InfParserSectionRoot(object):
|
||||
def __init__(self):
|
||||
@ -190,19 +190,19 @@ class InfParserSectionRoot(object):
|
||||
# Macros defined in [Define] section are file scope global
|
||||
#
|
||||
self.FileLocalMacros = {}
|
||||
|
||||
|
||||
#
|
||||
# Current Section Header content.
|
||||
# Current Section Header content.
|
||||
#
|
||||
self.SectionHeaderContent = []
|
||||
|
||||
#
|
||||
# Last time Section Header content.
|
||||
# Last time Section Header content.
|
||||
#
|
||||
self.LastSectionHeaderContent = []
|
||||
|
||||
self.LastSectionHeaderContent = []
|
||||
|
||||
self.FullPath = ''
|
||||
|
||||
|
||||
self.InfDefSection = None
|
||||
self.InfBuildOptionSection = None
|
||||
self.InfLibraryClassSection = None
|
||||
@ -219,4 +219,4 @@ class InfParserSectionRoot(object):
|
||||
self.InfSmmDepexSection = None
|
||||
self.InfBinariesSection = None
|
||||
self.InfHeader = None
|
||||
self.InfSpecialCommentSection = None
|
||||
self.InfSpecialCommentSection = None
|
||||
|
Reference in New Issue
Block a user