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:
Liming Gao
2018-07-05 17:40:04 +08:00
parent 39456d00f3
commit f7496d7173
289 changed files with 10647 additions and 10647 deletions

View File

@@ -1,11 +1,11 @@
## @file DecPomAlignment.py
# This file contained the adapter for convert INF parser object to POM Object
#
# Copyright (c) 2011 - 2016, 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,
@@ -106,17 +106,17 @@ class DecPomAlignment(PackageObject):
self.DecParser = None
self.UniFileClassObject = None
self.PcdDefaultValueDict = {}
#
# Load Dec file
#
self.LoadDecFile(Filename)
#
# Transfer to Package Object if IsToPackage is True
#
self.DecToPackage()
## Load Dec file
#
# Load the file if it exists
@@ -132,13 +132,13 @@ class DecPomAlignment(PackageObject):
self.SetFullPath(Filename)
self.SetRelaPath(Path)
self.SetFileName(Name)
self.SetPackagePath(GetRelativePath(Path, self.WorkspaceDir))
self.SetPackagePath(GetRelativePath(Path, self.WorkspaceDir))
self.SetCombinePath(GetRelativePath(Filename, self.WorkspaceDir))
self.DecParser = Dec(Filename)
## Transfer to Package Object
#
#
# Transfer all contents of a Dec file to a standard Package Object
#
def DecToPackage(self):
@@ -146,12 +146,12 @@ class DecPomAlignment(PackageObject):
# Init global information for the file
#
ContainerFile = self.GetFullPath()
#
# Generate Package Header
#
self.GenPackageHeader(ContainerFile)
#
# Generate Includes
#
@@ -171,28 +171,28 @@ class DecPomAlignment(PackageObject):
# Generate Ppis
#
self.GenGuidProtocolPpis(TAB_PPIS, ContainerFile)
#
# Generate LibraryClasses
#
self.GenLibraryClasses(ContainerFile)
#
# Generate Pcds
#
self.GenPcds(ContainerFile)
#
# Generate Module File list, will be used later on to generate
# Generate Module File list, will be used later on to generate
# distribution
#
self.GenModuleFileList(ContainerFile)
#
# Generate user extensions
#
self.GenUserExtensions()
## Generate user extension
#
#
@@ -231,7 +231,7 @@ class DecPomAlignment(PackageObject):
PrivateUserExtension.SetIdentifier(DT.TAB_PRIVATE)
PrivateUserExtension.SetUserID(DT.TAB_INTEL)
self.SetUserExtensionList(self.GetUserExtensionList() + [PrivateUserExtension])
## Generate miscellaneous files on DEC file
#
#
@@ -249,23 +249,23 @@ class DecPomAlignment(PackageObject):
FileObj.SetURI(FileName)
MiscFileObj.SetFileList(MiscFileObj.GetFileList()+[FileObj])
else:
Logger.Error("InfParser",
Logger.Error("InfParser",
FORMAT_INVALID,
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Line),
File=self.GetFileName(),
ExtraData=Line)
self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])
ExtraData=Line)
self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])
## Generate Package Header
#
# Gen Package Header of Dec as <Key> = <Value>
#
# @param ContainerFile: The Dec file full path
# @param ContainerFile: The Dec file full path
#
def GenPackageHeader(self, ContainerFile):
Logger.Debug(2, "Generate PackageHeader ...")
DefinesDict = {}
#
# Update all defines item in database
#
@@ -293,12 +293,12 @@ class DecPomAlignment(PackageObject):
UniFileClassObject([PathClass(os.path.join(DefObj.GetPackagePath(), DefObj.GetPackageUniFile()))])
else:
self.UniFileClassObject = None
if DefinesDict:
UserExtension = UserExtensionObject()
UserExtension.SetDefinesDict(DefinesDict)
UserExtension.SetIdentifier('DefineModifiers')
UserExtension.SetUserID('EDK2')
UserExtension.SetUserID('EDK2')
self.SetUserExtensionList(
self.GetUserExtensionList() + [UserExtension]
)
@@ -321,7 +321,7 @@ class DecPomAlignment(PackageObject):
self.SetCopyright(('', Copyright))
if License:
self.SetLicense(('', License))
#
# Get Binary header information
#
@@ -329,7 +329,7 @@ class DecPomAlignment(PackageObject):
Abstract, Description, Copyright, License = \
ParseHeaderCommentSection(self.DecParser.BinaryHeadComment,
ContainerFile, True)
if not Abstract or not Description or not Copyright or not License:
Logger.Error('MkPkg',
FORMAT_INVALID,
@@ -343,7 +343,7 @@ class DecPomAlignment(PackageObject):
BinaryAbstractList = []
BinaryDescriptionList = []
#Get Binary header from UNI file
# Initialize the UniStrDict dictionary, top keys are language codes
UniStrDict = {}
@@ -359,7 +359,7 @@ class DecPomAlignment(PackageObject):
if StringDefClassObject.StringName == TAB_DEC_BINARY_DESCRIPTION:
if (Lang, ConvertSpecialUnicodes(StringDefClassObject.StringValue)) \
not in self.GetBinaryHeaderDescription():
BinaryDescriptionList.append((Lang,
BinaryDescriptionList.append((Lang,
ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
#Combine Binary header from DEC file and UNI file
BinaryAbstractList = self.GetBinaryHeaderAbstract() + BinaryAbstractList
@@ -376,13 +376,13 @@ class DecPomAlignment(PackageObject):
BinaryUserExtension.SetIdentifier(TAB_BINARY_HEADER_IDENTIFIER)
BinaryUserExtension.SetUserID(TAB_BINARY_HEADER_USERID)
self.SetUserExtensionList(self.GetUserExtensionList() + [BinaryUserExtension])
## GenIncludes
#
# Gen Includes of Dec
#
# @param ContainerFile: The Dec file full path
#
# @param ContainerFile: The Dec file full path
#
def GenIncludes(self, ContainerFile):
if ContainerFile:
@@ -402,17 +402,17 @@ class DecPomAlignment(PackageObject):
IncludesDict[IncludePath] = IncludesDict[IncludePath] + Item.GetArchList()
else:
IncludesDict[IncludePath] = Item.GetArchList()
#
#
# get the standardIncludeFileList(industry), packageIncludeFileList
# (others) for PackageObject
#
# (others) for PackageObject
#
PackagePath = os.path.split(self.GetFullPath())[0]
IncludePathList = \
sorted([os.path.normpath(Path) + sep for Path in IncludesDict.keys()])
#
# get a non-overlap set of include path, IncludePathList should be
# get a non-overlap set of include path, IncludePathList should be
# sorted, and path should be end with path seperator '\'
#
NonOverLapList = []
@@ -429,7 +429,7 @@ class DecPomAlignment(PackageObject):
#
for IndexN in range (0, len(IncludePathList)):
IncludePathList[IndexN] = os.path.normpath(IncludePathList[IndexN])
IncludePathList.sort()
IncludePathList.sort()
IncludePathList.reverse()
#
# save the include path list for later usage
@@ -437,7 +437,7 @@ class DecPomAlignment(PackageObject):
self.SetIncludePathList(IncludePathList)
StandardIncludeFileList = []
PackageIncludeFileList = []
IncludeFileList = []
for Path in NonOverLapList:
FileList = GetFiles(os.path.join(PackagePath, Path), ['CVS', '.svn'], False)
@@ -445,9 +445,9 @@ class DecPomAlignment(PackageObject):
for Includefile in IncludeFileList:
ExtName = os.path.splitext(Includefile)[1]
if ExtName.upper() == '.DEC' and self.CheckMulDec:
Logger.Error('MkPkg',
Logger.Error('MkPkg',
UPT_MUL_DEC_ERROR,
ST.ERR_MUL_DEC_ERROR%(os.path.dirname(ContainerFile),
ST.ERR_MUL_DEC_ERROR%(os.path.dirname(ContainerFile),
os.path.basename(ContainerFile),
Includefile))
@@ -462,15 +462,15 @@ class DecPomAlignment(PackageObject):
if Includefile.find('IndustryStandard') != -1:
StandardIncludeFileList.append(Include)
else:
PackageIncludeFileList.append(Include)
PackageIncludeFileList.append(Include)
self.SetStandardIncludeFileList(StandardIncludeFileList)
#
# put include path into the PackageIncludeFileList
#
PackagePathList = []
IncObj = self.DecParser.GetIncludeSectionObject()
IncObj = self.DecParser.GetIncludeSectionObject()
for Item in IncObj.GetAllIncludes():
IncludePath = Item.File
Include = IncludeObject()
@@ -478,13 +478,13 @@ class DecPomAlignment(PackageObject):
Include.SetSupArchList(Item.GetArchList())
PackagePathList.append(Include)
self.SetPackageIncludeFileList(PackagePathList + PackageIncludeFileList)
## GenPpis
#
# Gen Ppis of Dec
# <CName>=<GuidValue>
#
# @param ContainerFile: The Dec file full path
# @param ContainerFile: The Dec file full path
#
def GenGuidProtocolPpis(self, Type, ContainerFile):
if ContainerFile:
@@ -504,7 +504,7 @@ class DecPomAlignment(PackageObject):
Factory = CreateGuidObject
elif Type == TAB_PROTOCOLS:
Obj = self.DecParser.GetProtocolSectionObject()
def CreateProtocolObject():
return ProtocolObject()
Factory = CreateProtocolObject
@@ -519,9 +519,9 @@ class DecPomAlignment(PackageObject):
# Should not be here
#
return
DeclarationsList = []
#
# Go through each arch
#
@@ -530,7 +530,7 @@ class DecPomAlignment(PackageObject):
Value = Item.GuidString
HelpTxt = ParseGenericComment(Item.GetHeadComment() + \
Item.GetTailComment())
ListObject = Factory()
ListObject.SetCName(Name)
ListObject.SetGuid(Value)
@@ -539,10 +539,10 @@ class DecPomAlignment(PackageObject):
if self.UniFileClassObject:
HelpTxt.SetLang(TAB_LANGUAGE_EN_X)
ListObject.SetHelpTextList([HelpTxt])
DeclarationsList.append(ListObject)
#
#
#GuidTypeList is abstracted from help
#
if Type == TAB_GUIDS:
@@ -551,20 +551,20 @@ class DecPomAlignment(PackageObject):
self.SetProtocolList(self.GetProtocolList() + DeclarationsList)
elif Type == TAB_PPIS:
self.SetPpiList(self.GetPpiList() + DeclarationsList)
## GenLibraryClasses
#
# Gen LibraryClasses of Dec
# <CName>=<GuidValue>
#
# @param ContainerFile: The Dec file full path
# @param ContainerFile: The Dec file full path
#
def GenLibraryClasses(self, ContainerFile):
if ContainerFile:
pass
Logger.Debug(2, "Generate %s ..." % TAB_LIBRARY_CLASSES)
LibraryClassDeclarations = []
LibObj = self.DecParser.GetLibraryClassSectionObject()
for Item in LibObj.GetAllLibraryclasses():
LibraryClass = LibraryClassObject()
@@ -578,44 +578,44 @@ class DecPomAlignment(PackageObject):
HelpTxt.SetLang(TAB_LANGUAGE_EN_X)
LibraryClass.SetHelpTextList([HelpTxt])
LibraryClassDeclarations.append(LibraryClass)
self.SetLibraryClassList(self.GetLibraryClassList() + \
LibraryClassDeclarations)
## GenPcds
#
# Gen Pcds of Dec
# <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
#
# @param ContainerFile: The Dec file full path
# @param ContainerFile: The Dec file full path
#
def GenPcds(self, ContainerFile):
Logger.Debug(2, "Generate %s ..." % TAB_PCDS)
PcdObj = self.DecParser.GetPcdSectionObject()
#
# Get all Pcds
#
#
PcdDeclarations = []
IterList = [
(TAB_PCDS_FIXED_AT_BUILD_NULL, 'FixedPcd'),
(TAB_PCDS_PATCHABLE_IN_MODULE_NULL, 'PatchPcd'),
(TAB_PCDS_PATCHABLE_IN_MODULE_NULL, 'PatchPcd'),
(TAB_PCDS_FEATURE_FLAG_NULL, 'FeaturePcd'),
(TAB_PCDS_DYNAMIC_EX_NULL, 'PcdEx'),
(TAB_PCDS_DYNAMIC_EX_NULL, 'PcdEx'),
(TAB_PCDS_DYNAMIC_NULL, 'Pcd')]
PromptStrList = []
HelpStrList = []
PcdErrStrList = []
# Initialize UniStrDict dictionary, top keys are language codes
UniStrDict = {}
StrList = []
Language = ''
if self.UniFileClassObject:
Language = TAB_LANGUAGE_EN_X
else:
Language = TAB_LANGUAGE_EN_US
if self.UniFileClassObject:
UniStrDict = self.UniFileClassObject.OrderedStringList
for Lang in UniStrDict:
@@ -652,7 +652,7 @@ class DecPomAlignment(PackageObject):
self.DecParser.GetDefineSectionMacro()
)
PcdDeclaration.SetSupArchList(Item.GetArchListOfType(PcdType))
#
# Get PCD error message from PCD error comment section in DEC file
#
@@ -662,7 +662,7 @@ class DecPomAlignment(PackageObject):
Key = (PcdDeclaration.GetTokenSpaceGuidCName(), PcdErr.GetErrorNumber())
PcdErr.SetErrorMessageList(PcdErr.GetErrorMessageList() + \
[(Language, self.DecParser.PcdErrorCommentDict[Key])])
for Index in range(0, len(PromptStrList)):
StrNameList = PromptStrList[Index][1].split('_')
if StrNameList[1].lower() == Item.TokenSpaceGuidCName.lower() and \
@@ -676,7 +676,7 @@ class DecPomAlignment(PackageObject):
break
else:
PcdDeclaration.SetPromptList(PcdDeclaration.GetPromptList() + [TxtObj])
for Index in range(0, len(HelpStrList)):
StrNameList = HelpStrList[Index][1].split('_')
if StrNameList[1].lower() == Item.TokenSpaceGuidCName.lower() and \
@@ -703,7 +703,7 @@ class DecPomAlignment(PackageObject):
(PcdErrStrList[Index][0], PcdErrStrList[Index][2]) not in PcdErr.GetErrorMessageList():
PcdErr.SetErrorMessageList(PcdErr.GetErrorMessageList() + \
[(PcdErrStrList[Index][0], PcdErrStrList[Index][2])])
#
# Check to prevent missing error message if a Pcd has the error code.
#
@@ -715,12 +715,12 @@ class DecPomAlignment(PackageObject):
ST.ERR_DECPARSE_PCD_UNMATCHED_ERRORCODE % PcdErr.GetErrorNumber(),
ContainerFile,
PcdErr.GetLineNum(),
PcdErr.GetFileLine())
PcdErr.GetFileLine())
PcdDeclarations.append(PcdDeclaration)
self.SetPcdList(self.GetPcdList() + PcdDeclarations)
self.CheckPcdValue()
##
# Get error message via language
# @param ErrorMessageList: Error message tuple list the language and its message
@@ -741,17 +741,17 @@ class DecPomAlignment(PackageObject):
return ErrorMessageList[0][1]
except IndexError:
return ''
return ''
return ''
##
# Replace the strings for Python eval function.
# @param ReplaceValue: The string that needs to be replaced.
# @return: The string was replaced, then eval function is always making out it.
# @param ReplaceValue: The string that needs to be replaced.
# @return: The string was replaced, then eval function is always making out it.
def ReplaceForEval(self, ReplaceValue, IsRange=False, IsExpr=False):
if self.FullPath:
pass
#
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
#
NOTNOT_Pattern = '[\t\s]*NOT[\t\s]+NOT[\t\s]*'
NOTGE_Pattern = '[\t\s]*NOT[\t\s]+GE[\t\s]*'
@@ -765,7 +765,7 @@ class DecPomAlignment(PackageObject):
ReplaceValue = re.compile(NOTLE_Pattern).sub('x > ', ReplaceValue)
ReplaceValue = re.compile(NOTGE_Pattern).sub('x < ', ReplaceValue)
ReplaceValue = re.compile(NOTEQ_Pattern).sub('x != ', ReplaceValue)
if IsRange:
ReplaceValue = ReplaceValue.replace('EQ', 'x ==')
ReplaceValue = ReplaceValue.replace('LT', 'x <')
@@ -779,9 +779,9 @@ class DecPomAlignment(PackageObject):
ReplaceValue = ReplaceValue.replace('LT', '<')
ReplaceValue = ReplaceValue.replace('LE', '<=')
ReplaceValue = ReplaceValue.replace('GT', '>')
ReplaceValue = ReplaceValue.replace('GE', '>=')
ReplaceValue = ReplaceValue.replace('XOR', '^')
ReplaceValue = ReplaceValue.replace('GE', '>=')
ReplaceValue = ReplaceValue.replace('XOR', '^')
ReplaceValue = ReplaceValue.replace('AND', 'and')
ReplaceValue = ReplaceValue.replace('&&', ' and ')
ReplaceValue = ReplaceValue.replace('xor', '^')
@@ -789,7 +789,7 @@ class DecPomAlignment(PackageObject):
ReplaceValue = ReplaceValue.replace('||', ' or ')
ReplaceValue = ReplaceValue.replace('NOT', 'not')
if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
ReplaceValue = ReplaceValue.replace('!', ' not ')
ReplaceValue = ReplaceValue.replace('!', ' not ')
if '.' in ReplaceValue:
Pattern = '[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
MatchedList = re.findall(Pattern, ReplaceValue)
@@ -797,7 +797,7 @@ class DecPomAlignment(PackageObject):
if MatchedItem not in self.PcdDefaultValueDict:
Logger.Error("Dec File Parser", FORMAT_INVALID, Message=ST.ERR_DECPARSE_PCD_NODEFINED % MatchedItem,
File=self.FullPath)
ReplaceValue = ReplaceValue.replace(MatchedItem, self.PcdDefaultValueDict[MatchedItem])
return ReplaceValue
@@ -809,7 +809,7 @@ class DecPomAlignment(PackageObject):
for Pcd in self.GetPcdList():
self.PcdDefaultValueDict[TAB_SPLIT.join((Pcd.GetTokenSpaceGuidCName(), Pcd.GetCName())).strip()] = \
Pcd.GetDefaultValue()
for Pcd in self.GetPcdList():
ValidationExpressions = []
PcdGuidName = TAB_SPLIT.join((Pcd.GetTokenSpaceGuidCName(), Pcd.GetCName()))
@@ -825,20 +825,20 @@ class DecPomAlignment(PackageObject):
if QuotedMatchedObj:
MatchedStr = QuotedMatchedObj.group().strip()
if MatchedStr.startswith('L'):
Expression = Expression.replace(MatchedStr, MatchedStr[1:].strip())
Expression = Expression.replace(MatchedStr, MatchedStr[1:].strip())
Expression = self.ReplaceForEval(Expression, IsExpr=True)
Expression = Expression.replace(PcdGuidName, 'x')
Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
ValidationExpressions.append((Expression, Message))
ValidationExpressions.append((Expression, Message))
ValidList = Valid.GetValidValue()
if ValidList:
ValidValue = 'x in %s' % [eval(v) for v in ValidList.split(' ') if v]
Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
ValidationExpressions.append((ValidValue, Message))
ValidValueRange = Valid.GetValidValueRange()
ValidValueRange = Valid.GetValidValueRange()
if ValidValueRange:
ValidValueRange = self.ReplaceForEval(ValidValueRange, IsRange=True)
if ValidValueRange.find('-') >= 0:
@@ -848,7 +848,7 @@ class DecPomAlignment(PackageObject):
ValidValueRange = 'x %s' % ValidValueRange
Message = self.GetEnErrorMessage(Valid.GetErrorMessageList())
ValidationExpressions.append((ValidValueRange, Message))
DefaultValue = self.PcdDefaultValueDict[PcdGuidName.strip()]
#
# Delete the 'L' prefix of a quoted string, this operation is for eval()
@@ -859,7 +859,7 @@ class DecPomAlignment(PackageObject):
MatchedStr = QuotedMatchedObj.group().strip()
if MatchedStr.startswith('L'):
DefaultValue = DefaultValue.replace(MatchedStr, MatchedStr[1:].strip())
try:
DefaultValue = eval(DefaultValue.replace('TRUE', 'True').replace('true', 'True')
.replace('FALSE', 'False').replace('false', 'False'))
@@ -877,11 +877,11 @@ class DecPomAlignment(PackageObject):
## GenModuleFileList
#
def GenModuleFileList(self, ContainerFile):
def GenModuleFileList(self, ContainerFile):
ModuleFileList = []
ContainerFileName = os.path.basename(ContainerFile)
ContainerFilePath = os.path.dirname(ContainerFile)
for Item in GetFiles(ContainerFilePath,
for Item in GetFiles(ContainerFilePath,
['CVS', '.svn'] + self.GetIncludePathList(), False):
ExtName = os.path.splitext(Item)[1]
if ExtName.lower() == '.inf':
@@ -889,14 +889,14 @@ class DecPomAlignment(PackageObject):
elif ExtName.upper() == '.DEC' and self.CheckMulDec:
if Item == ContainerFileName:
continue
Logger.Error('MkPkg',
Logger.Error('MkPkg',
UPT_MUL_DEC_ERROR,
ST.ERR_MUL_DEC_ERROR%(ContainerFilePath,
ContainerFileName,
ST.ERR_MUL_DEC_ERROR%(ContainerFilePath,
ContainerFileName,
Item))
self.SetModuleFileList(ModuleFileList)
## Show detailed information of Package
#
# Print all members and their values of Package class
@@ -906,7 +906,7 @@ class DecPomAlignment(PackageObject):
print('\nBaseName =', self.GetBaseName())
print('\nVersion =', self.GetVersion())
print('\nGuid =', self.GetGuid())
print('\nStandardIncludes = %d ' \
% len(self.GetStandardIncludeFileList()), end=' ')
for Item in self.GetStandardIncludeFileList():
@@ -915,7 +915,7 @@ class DecPomAlignment(PackageObject):
% len(self.GetPackageIncludeFileList()), end=' ')
for Item in self.GetPackageIncludeFileList():
print(Item.GetFilePath(), ' ', Item.GetSupArchList())
print('\nGuids =', self.GetGuidList())
for Item in self.GetGuidList():
print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
@@ -937,7 +937,7 @@ class DecPomAlignment(PackageObject):
'ValidUsage=', Item.GetValidUsage(), \
'SupArchList', Item.GetSupArchList(), \
'Token=', Item.GetToken(), 'DatumType=', Item.GetDatumType())
for Item in self.GetMiscFileList():
print(Item.GetName())
for FileObjectItem in Item.GetFileList():
@@ -947,11 +947,11 @@ class DecPomAlignment(PackageObject):
## GenPcdDeclaration
#
# @param ContainerFile: File name of the DEC file
# @param PcdInfo: Pcd information, of format (TokenGuidCName,
# TokenName, Value, DatumType, Token, Type,
# @param PcdInfo: Pcd information, of format (TokenGuidCName,
# TokenName, Value, DatumType, Token, Type,
# GenericComment, TailComment, Arch)
# @param Language: The language of HelpText, Prompt
#
# @param Language: The language of HelpText, Prompt
#
def GenPcdDeclaration(ContainerFile, PcdInfo, Language, MacroReplaceDict):
HelpStr = ''
PromptStr = ''
@@ -973,28 +973,28 @@ def GenPcdDeclaration(ContainerFile, PcdInfo, Language, MacroReplaceDict):
SupArchList = [Arch]
Pcd.SetSupArchList(SupArchList)
if GenericComment:
HelpStr, PcdErrList, PromptStr = ParseDecPcdGenericComment(GenericComment,
ContainerFile,
TokenGuidCName,
HelpStr, PcdErrList, PromptStr = ParseDecPcdGenericComment(GenericComment,
ContainerFile,
TokenGuidCName,
TokenName,
MacroReplaceDict)
if PcdErrList:
Pcd.SetPcdErrorsList(PcdErrList)
if TailComment:
SupModuleList, TailHelpStr = ParseDecPcdTailComment(TailComment,
SupModuleList, TailHelpStr = ParseDecPcdTailComment(TailComment,
ContainerFile)
if SupModuleList:
Pcd.SetSupModuleList(SupModuleList)
if HelpStr and (not HelpStr.endswith('\n')) and TailHelpStr:
HelpStr += '\n'
HelpStr += TailHelpStr
if HelpStr:
HelpTxtObj = TextObject()
HelpTxtObj.SetLang(Language)
HelpTxtObj.SetLang(Language)
HelpTxtObj.SetString(HelpStr)
Pcd.SetHelpTextList([HelpTxtObj])
if PromptStr:

View File

@@ -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,
@@ -59,8 +59,8 @@ from Common.MultipleWorkspace import MultipleWorkspace as mws
#
class InfPomAlignment(ModuleObject):
## Construct of InfPomAlignment
# Skip means that UPT don't care the syntax of INF, this may be the not
# distributed INF files during creation or the INF files checked for
# Skip means that UPT don't care the syntax of INF, this may be the not
# distributed INF files during creation or the INF files checked for
# dependency rule during remove.
#
def __init__(self, FileName, WorkSpace=None, PackagePath='', Skip=False):
@@ -90,12 +90,12 @@ class InfPomAlignment(ModuleObject):
self._GenInfPomObjects(Skip)
##
# Generate all POM objects, the original input comes
# Generate all POM objects, the original input comes
# from INF parser's output
#
def _GenInfPomObjects(self, Skip):
#
# Call INF Parser to get information from INF file
# Call INF Parser to get information from INF file
#
self.Parser = InfParser.InfParser(self.FileName, self.WorkSpace)
self.FullPath = self.Parser.FullPath
@@ -144,8 +144,8 @@ class InfPomAlignment(ModuleObject):
self.SetFileName(self.FileName)
self.SetFullPath(self.FullPath)
#
# The INF's filename (without the directory path or the extension)
# must be used for the value of the
# The INF's filename (without the directory path or the extension)
# must be used for the value of the
# ModuleSurfaceArea.Header.Name element
#
self.SetName(os.path.splitext(os.path.basename(self.FileName))[0])
@@ -184,7 +184,7 @@ class InfPomAlignment(ModuleObject):
#
# must exist items in INF define section
# MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING
# MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING
#
if DefineObj.GetModuleType() is None:
Logger.Error("InfParser", FORMAT_INVALID,
@@ -194,7 +194,7 @@ class InfPomAlignment(ModuleObject):
ModuleType = DefineObj.GetModuleType().GetValue()
if ModuleType:
#
# Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only
# Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only
# libraries are permitted to a have a MODULE_TYPE of "BASE".
#
if len(DefineObj.LibraryClass) == 0 and ModuleType == 'BASE':
@@ -248,7 +248,7 @@ class InfPomAlignment(ModuleObject):
Logger.Error("Parser", PARSER_ERROR, ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF, ExtraData=self.FullPath,
RaiseError=Logger.IS_RAISE_ERROR)
#
# if there is Shadow, Should judge the MODULE_TYPE in
# if there is Shadow, Should judge the MODULE_TYPE in
# SEC, PEI_CORE and PEIM
#
if DefineObj.GetShadow():
@@ -283,7 +283,7 @@ class InfPomAlignment(ModuleObject):
self._GenSpecialComments()
#
# put all define statement into user-extension sections
#
#
DefinesDictNew = GenModuleHeaderUserExt(DefineObj, ArchString)
if DefinesDictNew:
UserExtension = CommonObject.UserExtensionObject()
@@ -293,7 +293,7 @@ class InfPomAlignment(ModuleObject):
self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
#
# Get all meta-file header information
# the record is list of items formated:
# the record is list of items formated:
# [LineValue, Arch, StartLine, ID, Third]
#
InfHeaderObj = self.Parser.InfHeader
@@ -356,13 +356,13 @@ class InfPomAlignment(ModuleObject):
self.SetExternList(self.GetExternList() + [Image])
#
# UNLOAD_IMAGE
#
#
UnloadImageList = DefineObj.GetUnloadImages()
for UnloadImage in UnloadImageList:
Image = ExternObject()
#
# Future enhancement
#
#
Image.SetUnloadImage(UnloadImage.GetCName())
self.SetExternList(self.GetExternList() + [Image])
#
@@ -373,7 +373,7 @@ class InfPomAlignment(ModuleObject):
Image = ExternObject()
#
# Future enhancement
#
#
Image.SetConstructor(ConstructorItem.GetCName())
self.SetExternList(self.GetExternList() + [Image])
#
@@ -384,7 +384,7 @@ class InfPomAlignment(ModuleObject):
Image = ExternObject()
#
# Future enhancement
#
#
Image.SetDestructor(DestructorItem.GetCName())
self.SetExternList(self.GetExternList() + [Image])
@@ -639,7 +639,7 @@ class InfPomAlignment(ModuleObject):
UserExtension = CommonObject.UserExtensionObject()
UserId = UserExtensionDataObj.GetUserId()
if UserId.startswith('"') and UserId.endswith('"'):
UserId = UserId[1:-1]
UserId = UserId[1:-1]
UserExtension.SetUserID(UserId)
Identifier = UserExtensionDataObj.GetIdString()
if Identifier.startswith('"') and Identifier.endswith('"'):
@@ -653,11 +653,11 @@ class InfPomAlignment(ModuleObject):
UserExtension.SetStatement(UserExtensionDataObj.GetContent())
UserExtension.SetSupArchList(ConvertArchList(UserExtensionDataObj.GetSupArchList()))
self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])
#
# Gen UserExtensions of TianoCore."BinaryHeader"
#
#Get Binary header from INF file
BinaryAbstractList = self.BinaryHeaderAbstractList
BinaryDescriptionList = self.BinaryHeaderDescriptionList
@@ -684,7 +684,7 @@ class InfPomAlignment(ModuleObject):
BinaryUserExtension.SetIdentifier(DT.TAB_BINARY_HEADER_IDENTIFIER)
BinaryUserExtension.SetUserID(DT.TAB_BINARY_HEADER_USERID)
self.SetUserExtensionList(self.GetUserExtensionList() + [BinaryUserExtension])
def _GenDepexesList(self, SmmDepexList, DxeDepexList, PeiDepexList):
if SmmDepexList:
self.SetSmmDepex(SmmDepexList)
@@ -802,7 +802,7 @@ class InfPomAlignment(ModuleObject):
BinaryData = BinaryObj.keys()
#
# If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section,
# If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section,
# then the ModuleSurfaceArea.BinaryModule attribute must be set to true. Otherwise, do not use the attribute
#
if BinaryObj and not self.Parser.InfSourcesSection.GetSources():
@@ -827,7 +827,7 @@ class InfPomAlignment(ModuleObject):
#
# BuildOption AsBuild Info
#
#
for BuildOptionItem in self.Parser.InfBuildOptionSection.GetBuildOptions():
AsBuildBuildOptionList.append(BuildOptionItem)
AsBuildIns.SetBuildFlagsList(AsBuildBuildOptionList)
@@ -849,14 +849,14 @@ class InfPomAlignment(ModuleObject):
TempPath = ModulePath
ModulePath = os.path.dirname(ModulePath)
PackageName = TempPath
DecFilePath = os.path.normpath(os.path.join(WorkSpace, PackageName))
DecFilePath = os.path.normpath(os.path.join(WorkSpace, PackageName))
if DecFilePath:
for File in os.listdir(DecFilePath):
if File.upper().endswith('.DEC'):
DecFileFullPath = os.path.normpath(os.path.join(DecFilePath, File))
DecObjList.append(DecPomAlignment(DecFileFullPath, self.WorkSpace))
BinariesDict, AsBuildIns, BinaryFileObjectList = GenBinaryData(BinaryData, BinaryObj,
BinariesDict,
AsBuildIns,
@@ -864,7 +864,7 @@ class InfPomAlignment(ModuleObject):
self.GetSupArchList(),
self.BinaryModule,
DecObjList)
BinariesDict2 = {}
for Key in BinariesDict:
ValueList = BinariesDict[Key]
@@ -872,7 +872,7 @@ class InfPomAlignment(ModuleObject):
BinariesDict2[Key] = ValueList
else:
#
# if there is no TagName, ToolCode, HelpStr,
# if there is no TagName, ToolCode, HelpStr,
# then do not need to put them into userextension
#
(Target, Family, TagName, HelpStr) = ValueList[0]
@@ -1000,7 +1000,7 @@ class InfPomAlignment(ModuleObject):
HelpTxtTailObj.SetLang(DT.TAB_LANGUAGE_EN_X)
HelpTxtTailObj.SetString(HelpString)
ListObject.SetHelpTextList([HelpTxtTailObj])
GuidProtocolPpiList.append(ListObject)
elif Type == DT.TAB_PROTOCOLS:
ProtocolData = ProtocolObj.keys()
@@ -1068,10 +1068,10 @@ class InfPomAlignment(ModuleObject):
FileObj.SetURI(FileName)
MiscFileObj.SetFileList(MiscFileObj.GetFileList()+[FileObj])
else:
Logger.Error("InfParser",
Logger.Error("InfParser",
FORMAT_INVALID,
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(Line),
File=GlobalData.gINF_MODULE_NAME,
ExtraData=Line)
self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])
ExtraData=Line)
self.SetMiscFileList(self.GetMiscFileList()+[MiscFileObj])

View File

@@ -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,
@@ -184,16 +184,16 @@ def GenBinaryData(BinaryData, BinaryObj, BinariesDict, AsBuildIns, BinaryFileObj
else:
TagName = ''
Family = ''
FFE = ItemObj.GetFeatureFlagExp()
#
# If have architecturie specified, then use the specified architecturie;
# If the section tag does not have an architecture modifier or the modifier is "common" (case in-sensitive),
# and the VALID_ARCHITECTURES comment exists, the list from the VALID_ARCHITECTURES comment
# and the VALID_ARCHITECTURES comment exists, the list from the VALID_ARCHITECTURES comment
# can be used for the attribute.
# If both not have VALID_ARCHITECTURE comment and no architecturie specified, then keep it empty.
#
#
SupArchList = sorted(ConvertArchList(ItemObj.GetSupArchList()))
if len(SupArchList) == 1 and SupArchList[0] == 'COMMON':
if not (len(OriSupArchList) == 1 or OriSupArchList[0] == 'COMMON'):
@@ -208,7 +208,7 @@ def GenBinaryData(BinaryData, BinaryObj, BinariesDict, AsBuildIns, BinaryFileObj
#
# Get GUID value of the GUID CName in the DEC file
#
if ItemObj.GetType() == DT.SUBTYPE_GUID_BINARY_FILE_TYPE:
if ItemObj.GetType() == DT.SUBTYPE_GUID_BINARY_FILE_TYPE:
if not CheckGuidRegFormat(ItemObj.GetGuidValue()):
if not DecObjList:
if DT.TAB_HORIZON_LINE_SPLIT in ItemObj.GetGuidValue() or \
@@ -231,12 +231,12 @@ def GenBinaryData(BinaryData, BinaryObj, BinariesDict, AsBuildIns, BinaryFileObj
FileNameObj.SetGuidValue(GuidObj.GetGuid())
break
if not FileNameObj.GetGuidValue():
if not FileNameObj.GetGuidValue():
Logger.Error("\nMkPkg",
FORMAT_INVALID,
ST.ERR_DECPARSE_CGUID_NOT_FOUND % \
(ItemObj.GetGuidValue()),
RaiseError=True)
RaiseError=True)
else:
FileNameObj.SetGuidValue(ItemObj.GetGuidValue().strip())

View File

@@ -4,11 +4,11 @@
# This file is required to make Python interpreter treat the directory
# as containing package.
#
# Copyright (c) 2011, 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,
@@ -17,4 +17,4 @@
'''
PomAdapter
'''
'''