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 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:
|
||||
|
Reference in New Issue
Block a user