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,
|
||||
@@ -123,7 +123,7 @@ class PromptXml(object):
|
||||
return CreateXmlElement('%s' % Key, Prompt.GetString(), [], [['Lang', Prompt.GetLang()]])
|
||||
def __str__(self):
|
||||
return "Prompt = %s Lang = %s" % (self.Prompt, self.Lang)
|
||||
|
||||
|
||||
##
|
||||
# HelpTextXml
|
||||
#
|
||||
@@ -184,7 +184,7 @@ class HeaderXml(object):
|
||||
self.CopyrightList.append((HeaderCopyrightLang, XmlElement(SubItem, '%s/Copyright' % Key)))
|
||||
for SubItem in XmlList(Item, '%s/License' % Key):
|
||||
HeaderLicenseLang = XmlAttribute(SubItem, 'Lang')
|
||||
self.LicenseList.append((HeaderLicenseLang, XmlElement(SubItem, '%s/License' % Key)))
|
||||
self.LicenseList.append((HeaderLicenseLang, XmlElement(SubItem, '%s/License' % Key)))
|
||||
ModuleHeader = ModuleObject()
|
||||
ModuleHeader.SetName(self.Name)
|
||||
ModuleHeader.SetBaseName(self.BaseName)
|
||||
@@ -379,7 +379,7 @@ class PackageHeaderXml(object):
|
||||
NodeList = [Element1,
|
||||
Element2
|
||||
]
|
||||
|
||||
|
||||
UNIPackageAbrstractList = []
|
||||
UNIPackageDescriptionList = []
|
||||
# Get Abstract and Description from Uni File
|
||||
@@ -391,11 +391,11 @@ class PackageHeaderXml(object):
|
||||
if not StringDefClassObject.StringValue:
|
||||
continue
|
||||
if StringDefClassObject.StringName == DataType.TAB_DEC_PACKAGE_ABSTRACT:
|
||||
UNIPackageAbrstractList.append((GetLanguageCode1766(Lang),
|
||||
UNIPackageAbrstractList.append((GetLanguageCode1766(Lang),
|
||||
ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
|
||||
|
||||
if StringDefClassObject.StringName == DataType.TAB_DEC_PACKAGE_DESCRIPTION:
|
||||
UNIPackageDescriptionList.append((GetLanguageCode1766(Lang),
|
||||
UNIPackageDescriptionList.append((GetLanguageCode1766(Lang),
|
||||
ConvertSpecialUnicodes(StringDefClassObject.StringValue)))
|
||||
|
||||
# Get Abstract and Description from DEC File Header
|
||||
@@ -411,7 +411,7 @@ class PackageHeaderXml(object):
|
||||
for (Lang, Value) in PackageObject2.GetDescription() + UNIPackageDescriptionList:
|
||||
if Value:
|
||||
NodeList.append(CreateXmlElement(DataType.TAB_HEADER_DESCRIPTION, Value, [], [['Lang', Lang]]))
|
||||
|
||||
|
||||
|
||||
NodeList.append(['PackagePath', PackageObject2.GetPackagePath()])
|
||||
AttributeList = []
|
||||
@@ -617,16 +617,16 @@ class UserExtensionsXml(object):
|
||||
self.BinaryAbstractList.append((BinaryAbstractLang, XmlElement(SubItem, '%s/BinaryAbstract' % Key)))
|
||||
for SubItem in XmlList(Item, '%s/BinaryDescription' % Key):
|
||||
BinaryDescriptionLang = XmlAttribute(SubItem, 'Lang')
|
||||
self.BinaryDescriptionList.append((BinaryDescriptionLang,
|
||||
self.BinaryDescriptionList.append((BinaryDescriptionLang,
|
||||
XmlElement(SubItem, '%s/BinaryDescription' % Key)))
|
||||
for SubItem in XmlList(Item, '%s/BinaryCopyright' % Key):
|
||||
BinaryCopyrightLang = XmlAttribute(SubItem, 'Lang')
|
||||
self.BinaryCopyrightList.append((BinaryCopyrightLang,
|
||||
self.BinaryCopyrightList.append((BinaryCopyrightLang,
|
||||
XmlElement(SubItem, '%s/BinaryCopyright' % Key)))
|
||||
for SubItem in XmlList(Item, '%s/BinaryLicense' % Key):
|
||||
BinaryLicenseLang = XmlAttribute(SubItem, 'Lang')
|
||||
self.BinaryLicenseList.append((BinaryLicenseLang,
|
||||
XmlElement(SubItem, '%s/BinaryLicense' % Key)))
|
||||
self.BinaryLicenseList.append((BinaryLicenseLang,
|
||||
XmlElement(SubItem, '%s/BinaryLicense' % Key)))
|
||||
|
||||
DefineItem = XmlNode(Item, '%s/Define' % Key)
|
||||
for SubItem in XmlList(DefineItem, 'Define/Statement'):
|
||||
@@ -697,7 +697,7 @@ class UserExtensionsXml(object):
|
||||
if Value:
|
||||
ChildElement = CreateXmlElement('BinaryLicense', Value, [], [])
|
||||
Root.appendChild(ChildElement)
|
||||
|
||||
|
||||
NodeList = []
|
||||
DefineDict = UserExtension.GetDefinesDict()
|
||||
if DefineDict:
|
||||
@@ -976,7 +976,7 @@ class FilenameXml(object):
|
||||
#
|
||||
if self.FileType == 'UEFI_IMAGE':
|
||||
self.FileType = 'PE32'
|
||||
|
||||
|
||||
Filename.SetGuidValue(Guid)
|
||||
Filename.SetFileType(self.FileType)
|
||||
Filename.SetFilename(self.Filename)
|
||||
|
@@ -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,
|
||||
@@ -46,17 +46,17 @@ class GuidProtocolPpiXml(object):
|
||||
self.CommonDefines = CommonDefinesXml()
|
||||
self.HelpText = []
|
||||
#
|
||||
# Guid/Ppi/Library, internal used for indicate return object for
|
||||
# Guid/Ppi/Library, internal used for indicate return object for
|
||||
# FromXml
|
||||
#
|
||||
self.Type = ''
|
||||
self.Type = ''
|
||||
#
|
||||
# there are slightly different field between package and module
|
||||
#
|
||||
self.Mode = Mode
|
||||
self.GuidType = ''
|
||||
self.VariableName = ''
|
||||
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
self.UiName = XmlAttribute(XmlNode(Item, '%s' % Key), 'UiName')
|
||||
self.GuidType = XmlAttribute(XmlNode(Item, '%s' % Key), 'GuidType')
|
||||
@@ -69,8 +69,8 @@ class GuidProtocolPpiXml(object):
|
||||
HelpTextObj = HelpTextXml()
|
||||
HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
|
||||
self.HelpText.append(HelpTextObj)
|
||||
|
||||
if self.Type == 'Guid':
|
||||
|
||||
if self.Type == 'Guid':
|
||||
GuidProtocolPpi = GuidObject()
|
||||
elif self.Type == 'Protocol':
|
||||
GuidProtocolPpi = ProtocolObject()
|
||||
@@ -92,7 +92,7 @@ class GuidProtocolPpiXml(object):
|
||||
['SupModList', GetStringOfList(GuidProtocolPpi.GetSupModuleList())], \
|
||||
['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
['GuidValue', GuidProtocolPpi.GetGuid()],
|
||||
['VariableName', GuidProtocolPpi.VariableName]
|
||||
]
|
||||
@@ -100,7 +100,7 @@ class GuidProtocolPpiXml(object):
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
def __str__(self):
|
||||
@@ -118,12 +118,12 @@ class GuidXml(GuidProtocolPpiXml):
|
||||
def __init__(self, Mode):
|
||||
GuidProtocolPpiXml.__init__(self, Mode)
|
||||
self.Type = 'Guid'
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
|
||||
|
||||
if self.Mode == 'Package':
|
||||
|
||||
|
||||
GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
GuidProtocolPpi.SetSupModuleList(self.CommonDefines.SupModList)
|
||||
GuidProtocolPpi.SetCName(self.CName)
|
||||
@@ -139,16 +139,16 @@ class GuidXml(GuidProtocolPpiXml):
|
||||
return GuidProtocolPpi
|
||||
|
||||
def ToXml(self, GuidProtocolPpi, Key):
|
||||
if self.Mode == 'Package':
|
||||
if self.Mode == 'Package':
|
||||
AttributeList = \
|
||||
[['GuidType', \
|
||||
GetStringOfList(GuidProtocolPpi.GetGuidTypeList())], \
|
||||
['SupArchList', \
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
|
||||
['SupModList', \
|
||||
GetStringOfList(GuidProtocolPpi.GetSupModuleList())],
|
||||
GetStringOfList(GuidProtocolPpi.GetSupModuleList())],
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
['GuidValue', GuidProtocolPpi.GetGuid()],
|
||||
]
|
||||
else:
|
||||
@@ -159,7 +159,7 @@ class GuidXml(GuidProtocolPpiXml):
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
|
||||
['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
['VariableName', GuidProtocolPpi.GetVariableName()]
|
||||
]
|
||||
|
||||
@@ -167,7 +167,7 @@ class GuidXml(GuidProtocolPpiXml):
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
#Protocol Xml
|
||||
@@ -176,11 +176,11 @@ class ProtocolXml(GuidProtocolPpiXml):
|
||||
def __init__(self, Mode):
|
||||
GuidProtocolPpiXml.__init__(self, Mode)
|
||||
self.Type = 'Protocol'
|
||||
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
|
||||
if self.Mode == 'Package':
|
||||
GuidProtocolPpi.SetFeatureFlag(self.CommonDefines.FeatureFlag)
|
||||
GuidProtocolPpi.SetFeatureFlag(self.CommonDefines.FeatureFlag)
|
||||
GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
GuidProtocolPpi.SetSupModuleList(self.CommonDefines.SupModList)
|
||||
GuidProtocolPpi.SetCName(self.CName)
|
||||
@@ -196,11 +196,11 @@ class ProtocolXml(GuidProtocolPpiXml):
|
||||
GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
GuidProtocolPpi.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
|
||||
GuidProtocolPpi.SetCName(self.CName)
|
||||
|
||||
|
||||
return GuidProtocolPpi
|
||||
|
||||
def ToXml(self, GuidProtocolPpi, Key):
|
||||
if self.Mode == 'Package':
|
||||
if self.Mode == 'Package':
|
||||
AttributeList = \
|
||||
[['SupArchList', \
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
|
||||
@@ -208,7 +208,7 @@ class ProtocolXml(GuidProtocolPpiXml):
|
||||
GetStringOfList(GuidProtocolPpi.GetSupModuleList())], \
|
||||
['FeatureFlag', GuidProtocolPpi.GetFeatureFlag()]
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
['GuidValue', GuidProtocolPpi.GetGuid()],
|
||||
]
|
||||
else:
|
||||
@@ -219,14 +219,14 @@ class ProtocolXml(GuidProtocolPpiXml):
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
|
||||
['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
]
|
||||
|
||||
|
||||
for Item in GuidProtocolPpi.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
#Ppi Xml
|
||||
@@ -235,7 +235,7 @@ class PpiXml(GuidProtocolPpiXml):
|
||||
def __init__(self, Mode):
|
||||
GuidProtocolPpiXml.__init__(self, Mode)
|
||||
self.Type = 'Ppi'
|
||||
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
GuidProtocolPpi = GuidProtocolPpiXml.FromXml(self, Item, Key)
|
||||
if self.Mode == 'Package':
|
||||
@@ -254,16 +254,16 @@ class PpiXml(GuidProtocolPpiXml):
|
||||
GuidProtocolPpi.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
GuidProtocolPpi.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
|
||||
GuidProtocolPpi.SetCName(self.CName)
|
||||
|
||||
|
||||
return GuidProtocolPpi
|
||||
|
||||
def ToXml(self, GuidProtocolPpi, Key):
|
||||
if self.Mode == 'Package':
|
||||
AttributeList = \
|
||||
[['SupArchList', \
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())],
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())],
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
['GuidValue', GuidProtocolPpi.GetGuid()],
|
||||
]
|
||||
else:
|
||||
@@ -274,9 +274,9 @@ class PpiXml(GuidProtocolPpiXml):
|
||||
GetStringOfList(GuidProtocolPpi.GetSupArchList())], \
|
||||
['FeatureFlag', ConvertNEToNOTEQ(GuidProtocolPpi.GetFeatureFlag())]
|
||||
]
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
NodeList = [['CName', GuidProtocolPpi.GetCName()],
|
||||
]
|
||||
|
||||
|
||||
for Item in GuidProtocolPpi.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
|
@@ -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,
|
||||
@@ -96,20 +96,20 @@ def ParseFileList(Line, Map, CurrentKey, PathFunc):
|
||||
Attr = Token.split(TAB_EQUAL_SPLIT)
|
||||
if len(Attr) != 2 or not Attr[0].strip() or not Attr[1].strip():
|
||||
return False, ST.ERR_WRONG_FILELIST_FORMAT
|
||||
|
||||
|
||||
Key = Attr[0].strip()
|
||||
Val = Attr[1].strip()
|
||||
if Key not in ['OS', 'Executable']:
|
||||
return False, ST.ERR_UNKNOWN_FILELIST_ATTR % Key
|
||||
|
||||
if Key == 'OS' and Val not in ["Win32", "Win64", "Linux32",
|
||||
"Linux64", "OS/X32", "OS/X64",
|
||||
|
||||
if Key == 'OS' and Val not in ["Win32", "Win64", "Linux32",
|
||||
"Linux64", "OS/X32", "OS/X64",
|
||||
"GenericWin", "GenericNix"]:
|
||||
return False, ST.ERR_FILELIST_ATTR % 'OS'
|
||||
elif Key == 'Executable' and Val not in ['true', 'false']:
|
||||
return False, ST.ERR_FILELIST_ATTR % 'Executable'
|
||||
FileList[1][Key] = Val
|
||||
|
||||
|
||||
Map[CurrentKey].append(FileList)
|
||||
return True, ''
|
||||
|
||||
@@ -143,7 +143,7 @@ def CreateHeaderXml(DistMap, Root):
|
||||
#
|
||||
# @param Map: Map
|
||||
# @param Root: Root
|
||||
# @param Tag: Tag
|
||||
# @param Tag: Tag
|
||||
#
|
||||
def CreateToolsXml(Map, Root, Tag):
|
||||
#
|
||||
@@ -225,7 +225,7 @@ def ValidateRegValues(Key, Value):
|
||||
def __ValidateDistHeaderName(Name):
|
||||
if len(Name) < 1:
|
||||
return False
|
||||
|
||||
|
||||
for Char in Name:
|
||||
if ord(Char) < 0x20 or ord(Char) >= 0x7f:
|
||||
return False
|
||||
@@ -314,12 +314,12 @@ def IniToXml(IniFile):
|
||||
'ToolsHeader' : ToolsMap,
|
||||
'MiscellaneousFilesHeader' : MiscMap
|
||||
}
|
||||
|
||||
|
||||
PathValidator = {
|
||||
'ToolsHeader' : ValidateToolsFile,
|
||||
'MiscellaneousFilesHeader' : ValidateMiscFile
|
||||
}
|
||||
|
||||
|
||||
ParsedSection = []
|
||||
|
||||
SectionName = ''
|
||||
@@ -339,13 +339,13 @@ def IniToXml(IniFile):
|
||||
if SectionName not in SectionMap:
|
||||
IniParseError(ST.ERR_SECTION_NAME_INVALID % SectionName,
|
||||
IniFile, Index+1)
|
||||
|
||||
|
||||
if SectionName in ParsedSection:
|
||||
IniParseError(ST.ERR_SECTION_REDEFINE % SectionName,
|
||||
IniFile, Index+1)
|
||||
else:
|
||||
ParsedSection.append(SectionName)
|
||||
|
||||
|
||||
Map = SectionMap[SectionName]
|
||||
continue
|
||||
if not Map:
|
||||
@@ -363,7 +363,7 @@ def IniToXml(IniFile):
|
||||
#
|
||||
# Special for FileList
|
||||
#
|
||||
Valid, Cause = ParseFileList(Line, Map, CurrentKey,
|
||||
Valid, Cause = ParseFileList(Line, Map, CurrentKey,
|
||||
PathValidator[SectionName])
|
||||
if not Valid:
|
||||
IniParseError(Cause, IniFile, Index+1)
|
||||
@@ -374,7 +374,7 @@ def IniToXml(IniFile):
|
||||
# Or if string on the left side of '=' is not a keyword
|
||||
#
|
||||
Map[CurrentKey] = ''.join([Map[CurrentKey], '\n', Line])
|
||||
Valid, Cause = ValidateValues(CurrentKey,
|
||||
Valid, Cause = ValidateValues(CurrentKey,
|
||||
Map[CurrentKey], SectionName)
|
||||
if not Valid:
|
||||
IniParseError(Cause, IniFile, Index+1)
|
||||
@@ -390,7 +390,7 @@ def IniToXml(IniFile):
|
||||
if Map[CurrentKey]:
|
||||
IniParseError(ST.ERR_KEYWORD_REDEFINE % CurrentKey,
|
||||
IniFile, Index+1)
|
||||
|
||||
|
||||
if id(Map) != id(PreMap) and Map['Copyright']:
|
||||
PreMap = Map
|
||||
Copyright = Map['Copyright'].lower()
|
||||
@@ -399,9 +399,9 @@ def IniToXml(IniFile):
|
||||
IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, Index)
|
||||
if not Copyright[Pos + len('copyright'):].lstrip(' ').startswith('('):
|
||||
IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, Index)
|
||||
|
||||
|
||||
if CurrentKey == 'FileList':
|
||||
Valid, Cause = ParseFileList(TokenList[1], Map, CurrentKey,
|
||||
Valid, Cause = ParseFileList(TokenList[1], Map, CurrentKey,
|
||||
PathValidator[SectionName])
|
||||
if not Valid:
|
||||
IniParseError(Cause, IniFile, Index+1)
|
||||
@@ -411,17 +411,17 @@ def IniToXml(IniFile):
|
||||
Map[CurrentKey], SectionName)
|
||||
if not Valid:
|
||||
IniParseError(Cause, IniFile, Index+1)
|
||||
|
||||
|
||||
if id(Map) != id(PreMap) and Map['Copyright'] and 'copyright' not in Map['Copyright'].lower():
|
||||
IniParseError(ST.ERR_COPYRIGHT_CONTENT, IniFile, LastIndex)
|
||||
|
||||
#
|
||||
# Check mandatory keys
|
||||
#
|
||||
CheckMdtKeys(DistMap, IniFile, LastIndex,
|
||||
#
|
||||
CheckMdtKeys(DistMap, IniFile, LastIndex,
|
||||
(('ToolsHeader', ToolsMap), ('MiscellaneousFilesHeader', MiscMap))
|
||||
)
|
||||
|
||||
|
||||
return CreateXml(DistMap, ToolsMap, MiscMap, IniFile)
|
||||
|
||||
|
||||
@@ -433,15 +433,15 @@ def IniToXml(IniFile):
|
||||
# @param LastIndex: Last index of Ini file
|
||||
# @param Maps: Tools and Misc section name and map. (('section_name', map),*)
|
||||
#
|
||||
def CheckMdtKeys(DistMap, IniFile, LastIndex, Maps):
|
||||
def CheckMdtKeys(DistMap, IniFile, LastIndex, Maps):
|
||||
MdtDistKeys = ['Name', 'GUID', 'Version', 'Vendor', 'Copyright', 'License', 'Abstract', 'XmlSpecification']
|
||||
for Key in MdtDistKeys:
|
||||
if Key not in DistMap or DistMap[Key] == '':
|
||||
IniParseError(ST.ERR_KEYWORD_MANDATORY % Key, IniFile, LastIndex+1)
|
||||
|
||||
|
||||
if '.' not in DistMap['Version']:
|
||||
DistMap['Version'] = DistMap['Version'] + '.0'
|
||||
|
||||
|
||||
DistMap['Date'] = str(strftime("%Y-%m-%dT%H:%M:%S", localtime()))
|
||||
|
||||
#
|
||||
@@ -464,10 +464,10 @@ def CheckMdtKeys(DistMap, IniFile, LastIndex, Maps):
|
||||
for Key in Map:
|
||||
if Map[Key]:
|
||||
NonEmptyKey += 1
|
||||
|
||||
|
||||
if NonEmptyKey > 0 and not Map['FileList']:
|
||||
IniParseError(ST.ERR_KEYWORD_MANDATORY % (Item[0] + '.FileList'), IniFile, LastIndex+1)
|
||||
|
||||
|
||||
if NonEmptyKey > 0 and not Map['Name']:
|
||||
IniParseError(ST.ERR_KEYWORD_MANDATORY % (Item[0] + '.Name'), IniFile, LastIndex+1)
|
||||
|
||||
@@ -478,7 +478,7 @@ def CheckMdtKeys(DistMap, IniFile, LastIndex, Maps):
|
||||
# @param MiscMap: Misc Content
|
||||
# @param IniFile: Ini File
|
||||
#
|
||||
def CreateXml(DistMap, ToolsMap, MiscMap, IniFile):
|
||||
def CreateXml(DistMap, ToolsMap, MiscMap, IniFile):
|
||||
Attrs = [['xmlns', 'http://www.uefi.org/2011/1.1'],
|
||||
['xmlns:xsi', 'http:/www.w3.org/2001/XMLSchema-instance'],
|
||||
]
|
||||
@@ -493,7 +493,7 @@ def CreateXml(DistMap, ToolsMap, MiscMap, IniFile):
|
||||
else:
|
||||
FileName = IniFile + '.xml'
|
||||
File = open(FileName, 'w')
|
||||
|
||||
|
||||
try:
|
||||
File.write(Root.toprettyxml(indent = ' '))
|
||||
finally:
|
||||
|
@@ -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,
|
||||
@@ -173,7 +173,7 @@ class PackageSurfaceAreaXml(object):
|
||||
if XmlNode(Item, '/PackageSurfaceArea/ClonedFrom'):
|
||||
ClonedFrom = Tmp.FromXml(XmlNode(Item, '/PackageSurfaceArea/ClonedFrom'), 'ClonedFrom')
|
||||
Package.SetClonedFromList([ClonedFrom])
|
||||
#
|
||||
#
|
||||
# LibraryClass
|
||||
#
|
||||
|
||||
@@ -254,7 +254,7 @@ class PackageSurfaceAreaXml(object):
|
||||
Tmp = PcdEntryXml()
|
||||
PcdEntry = Tmp.FromXml2(SubItem, 'PcdEntry')
|
||||
Package.SetPcdList(Package.GetPcdList() + [PcdEntry])
|
||||
|
||||
|
||||
#
|
||||
# Get PcdErrorCommentDict from PcdError in PcdEntry Node
|
||||
#
|
||||
@@ -263,7 +263,7 @@ class PackageSurfaceAreaXml(object):
|
||||
if PcdErrorMessageList:
|
||||
Package.PcdErrorCommentDict[(PcdEntry.GetTokenSpaceGuidCName(), PcdErrorObj.GetErrorNumber())] = \
|
||||
PcdErrorMessageList
|
||||
|
||||
|
||||
|
||||
if XmlList(Item, '/PackageSurfaceArea/PcdDeclarations') and not \
|
||||
XmlList(Item, '/PackageSurfaceArea/PcdDeclarations/PcdEntry'):
|
||||
@@ -285,7 +285,7 @@ class PackageSurfaceAreaXml(object):
|
||||
Module = Tmp.FromXml(SubItem, 'ModuleSurfaceArea')
|
||||
ModuleDictKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
|
||||
Package.ModuleDict[ModuleDictKey] = Module
|
||||
#
|
||||
#
|
||||
# MiscellaneousFile
|
||||
#
|
||||
Tmp = MiscellaneousFileXml()
|
||||
@@ -295,7 +295,7 @@ class PackageSurfaceAreaXml(object):
|
||||
else:
|
||||
Package.SetMiscFileList([])
|
||||
|
||||
#
|
||||
#
|
||||
# UserExtensions
|
||||
#
|
||||
for Item in XmlList(Item, '/PackageSurfaceArea/UserExtensions'):
|
||||
@@ -372,7 +372,7 @@ class PackageSurfaceAreaXml(object):
|
||||
GuidProtocolPpiNode.appendChild\
|
||||
(Tmp.ToXml(GuidProtocolPpi, 'Entry'))
|
||||
DomPackage.appendChild(GuidProtocolPpiNode)
|
||||
#
|
||||
#
|
||||
# Ppi
|
||||
#
|
||||
GuidProtocolPpiNode = CreateXmlElement('PpiDeclarations', '', [], [])
|
||||
|
@@ -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,7 +49,7 @@ class PcdErrorXml(object):
|
||||
self.Expression = ''
|
||||
self.ErrorNumber = ''
|
||||
self.ErrorMessage = []
|
||||
|
||||
|
||||
def FromXml(self, Item, Key):
|
||||
self.ValidValueList = XmlElement(Item, '%s/ValidValueList' % Key)
|
||||
self.ValidValueListLang = \
|
||||
@@ -62,7 +62,7 @@ class PcdErrorXml(object):
|
||||
ErrorMessageLang = \
|
||||
XmlAttribute(XmlNode(ErrMsg, 'ErrorMessage'), 'Lang')
|
||||
self.ErrorMessage.append((ErrorMessageLang, ErrorMessageString))
|
||||
|
||||
|
||||
Error = PcdErrorObject()
|
||||
Error.SetValidValue(self.ValidValueList)
|
||||
Error.SetValidValueLang(self.ValidValueListLang)
|
||||
@@ -70,7 +70,7 @@ class PcdErrorXml(object):
|
||||
Error.SetExpression(self.Expression)
|
||||
Error.SetErrorNumber(self.ErrorNumber)
|
||||
Error.SetErrorMessageList(self.ErrorMessage)
|
||||
|
||||
|
||||
return Error
|
||||
|
||||
def ToXml(self, PcdError, Key):
|
||||
@@ -100,9 +100,9 @@ class PcdErrorXml(object):
|
||||
CreateXmlElement('ErrorMessage', Item[1], [], [['Lang', Item[0]]])
|
||||
NodeList.append(Element)
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
||||
if self.Expression:
|
||||
pass
|
||||
@@ -125,7 +125,7 @@ class PcdErrorXml(object):
|
||||
for MatchObj in HexMatch2.finditer(ValidRange):
|
||||
MatchStr = MatchObj.group()
|
||||
TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert INT2 format range
|
||||
#
|
||||
@@ -133,36 +133,36 @@ class PcdErrorXml(object):
|
||||
for MatchObj in IntMatch2.finditer(ValidRange):
|
||||
MatchStr = MatchObj.group()
|
||||
TransferedRangeStr = ' '.join(['', PcdName, MatchStr.strip()])
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert HEX1 format range
|
||||
#
|
||||
if HexMatch1:
|
||||
HexMatchedList += HexMatch1.findall(ValidRange)
|
||||
|
||||
|
||||
for MatchStr in HexMatchedList:
|
||||
RangeItemList = MatchStr.strip().split('-')
|
||||
TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
|
||||
(PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
#
|
||||
# Convert INT1 format range
|
||||
#
|
||||
if IntMatch1:
|
||||
IntMatchedList += IntMatch1.findall(ValidRange)
|
||||
|
||||
|
||||
for MatchStr in IntMatchedList:
|
||||
RangeItemList = MatchStr.strip().split('-')
|
||||
TransferedRangeStr = '(%s GE %s) AND (%s LE %s)' % \
|
||||
(PcdName, RangeItemList[0].strip(), PcdName, RangeItemList[1].strip())
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
|
||||
ValidRange = ValidRange.replace(MatchStr, TransferedRangeStr)
|
||||
|
||||
return ValidRange
|
||||
|
||||
|
||||
def TransferValidEpxr2ValidRange(self, ValidRangeExpr):
|
||||
if self.Expression:
|
||||
pass
|
||||
|
||||
|
||||
PCD_PATTERN = \
|
||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
||||
IntPattern1 = \
|
||||
@@ -170,16 +170,16 @@ class PcdErrorXml(object):
|
||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
||||
IntPattern1 = IntPattern1.replace(' ', '')
|
||||
IntPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||
|
||||
|
||||
HexPattern1 = \
|
||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
||||
HexPattern1 = HexPattern1.replace(' ', '')
|
||||
HexPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
||||
|
||||
|
||||
#
|
||||
# Do the Hex1 conversion
|
||||
#
|
||||
#
|
||||
HexMatchedList = re.compile(HexPattern1).findall(ValidRangeExpr)
|
||||
HexRangeDict = {}
|
||||
for HexMatchedItem in HexMatchedList:
|
||||
@@ -188,8 +188,8 @@ class PcdErrorXml(object):
|
||||
#
|
||||
RangeItemList = re.compile('[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||
|
||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||
|
||||
for Key in HexRangeDict.keys():
|
||||
MaxItem = MixItem = ''
|
||||
if int(HexRangeDict[Key][0], 16) > int(HexRangeDict[Key][1], 16):
|
||||
@@ -198,7 +198,7 @@ class PcdErrorXml(object):
|
||||
else:
|
||||
MaxItem = HexRangeDict[Key][1]
|
||||
MixItem = HexRangeDict[Key][0]
|
||||
|
||||
|
||||
Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
|
||||
ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
|
||||
#
|
||||
@@ -211,9 +211,9 @@ class PcdErrorXml(object):
|
||||
# To match items on both sides of '-'
|
||||
#
|
||||
RangeItemList = re.compile('[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
if RangeItemList and len(RangeItemList) == 2:
|
||||
IntRangeDict[MatchedItem] = RangeItemList
|
||||
|
||||
|
||||
for Key in IntRangeDict.keys():
|
||||
MaxItem = MixItem = ''
|
||||
if int(IntRangeDict[Key][0]) > int(IntRangeDict[Key][1]):
|
||||
@@ -222,11 +222,11 @@ class PcdErrorXml(object):
|
||||
else:
|
||||
MaxItem = IntRangeDict[Key][1]
|
||||
MixItem = IntRangeDict[Key][0]
|
||||
|
||||
|
||||
Range = ' %s - %s' % (MixItem.strip(), MaxItem.strip())
|
||||
ValidRangeExpr = ValidRangeExpr.replace(Key, Range)
|
||||
#
|
||||
# Do the HEX2 conversion
|
||||
# Do the HEX2 conversion
|
||||
#
|
||||
for MatchObj in re.compile(HexPattern2).finditer(ValidRangeExpr):
|
||||
MatchStr = MatchObj.group()
|
||||
@@ -241,8 +241,8 @@ class PcdErrorXml(object):
|
||||
ValidRangeExpr = ValidRangeExpr.replace(MatchStr, Range)
|
||||
|
||||
return ValidRangeExpr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return "ValidValueList = %s ValidValueListLang = %s ValidValueRange \
|
||||
@@ -275,7 +275,7 @@ class PcdEntryXml(object):
|
||||
|
||||
##
|
||||
# AsBuilt will use FromXml
|
||||
#
|
||||
#
|
||||
def FromXml(self, Item, Key):
|
||||
self.PcdItemType = \
|
||||
XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType')
|
||||
@@ -297,7 +297,7 @@ class PcdEntryXml(object):
|
||||
self.Value = XmlElement(Item, '%s/Value' % Key)
|
||||
self.Offset = XmlElement(Item, '%s/Offset' % Key)
|
||||
self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key)
|
||||
|
||||
|
||||
for HelpTextItem in XmlList(Item, '%s/HelpText' % Key):
|
||||
HelpTextObj = HelpTextXml()
|
||||
HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key)
|
||||
@@ -306,9 +306,9 @@ class PcdEntryXml(object):
|
||||
PcdErrorObjXml = PcdErrorXml()
|
||||
PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError')
|
||||
self.PcdError.append(PcdErrorObj)
|
||||
|
||||
|
||||
self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
|
||||
|
||||
|
||||
PcdEntry = PcdObject()
|
||||
PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName)
|
||||
@@ -326,11 +326,11 @@ class PcdEntryXml(object):
|
||||
|
||||
PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
|
||||
PcdEntry.SetPcdErrorsList(self.PcdError)
|
||||
|
||||
|
||||
return PcdEntry
|
||||
##
|
||||
# Package will use FromXml2
|
||||
#
|
||||
#
|
||||
def FromXml2(self, Item, Key):
|
||||
self.TokenSpaceGuidCName = \
|
||||
XmlElement(Item, '%s/TokenSpaceGuidCname' % Key)
|
||||
@@ -353,9 +353,9 @@ class PcdEntryXml(object):
|
||||
PcdErrorObjXml = PcdErrorXml()
|
||||
PcdErrorObj = PcdErrorObjXml.FromXml(PcdErrorItem, 'PcdError')
|
||||
self.PcdError.append(PcdErrorObj)
|
||||
|
||||
|
||||
self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
|
||||
|
||||
|
||||
PcdEntry = PcdObject()
|
||||
PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
PcdEntry.SetSupModuleList(self.CommonDefines.SupModList)
|
||||
@@ -367,11 +367,11 @@ class PcdEntryXml(object):
|
||||
PcdEntry.SetDefaultValue(self.DefaultValue)
|
||||
PcdEntry.SetMaxDatumSize(self.MaxDatumSize)
|
||||
PcdEntry.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag))
|
||||
|
||||
|
||||
PcdEntry.SetPromptList(GetPromptList(self.Prompt))
|
||||
PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
|
||||
PcdEntry.SetPcdErrorsList(self.PcdError)
|
||||
|
||||
|
||||
return PcdEntry
|
||||
|
||||
##
|
||||
@@ -394,9 +394,9 @@ class PcdEntryXml(object):
|
||||
PcdErrorObj = PcdErrorXml()
|
||||
PcdErrorObj.FromXml(PcdErrorItem, 'PcdError')
|
||||
self.PcdError.append(PcdErrorObj)
|
||||
|
||||
|
||||
self.DefaultValue = ConvertNOTEQToNE(self.DefaultValue)
|
||||
|
||||
|
||||
PcdEntry = PcdObject()
|
||||
PcdEntry.SetSupArchList(self.CommonDefines.SupArchList)
|
||||
PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName)
|
||||
@@ -408,15 +408,15 @@ class PcdEntryXml(object):
|
||||
|
||||
PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText))
|
||||
PcdEntry.SetPcdErrorsList(self.PcdError)
|
||||
|
||||
|
||||
return PcdEntry
|
||||
|
||||
|
||||
def ToXml(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['PcdUsage', PcdEntry.GetValidUsage()], \
|
||||
@@ -425,7 +425,7 @@ class PcdEntryXml(object):
|
||||
]
|
||||
NodeList = [['TokenSpaceGuidCname', PcdEntry.GetTokenSpaceGuidCName()],
|
||||
['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
|
||||
['Token', PcdEntry.GetToken()],
|
||||
['Token', PcdEntry.GetToken()],
|
||||
['CName', PcdEntry.GetCName()],
|
||||
['DatumType', PcdEntry.GetDatumType()],
|
||||
['ValidUsage', GetStringOfList(PcdEntry.GetValidUsage())],
|
||||
@@ -433,26 +433,26 @@ class PcdEntryXml(object):
|
||||
['MaxDatumSize', PcdEntry.GetMaxDatumSize()],
|
||||
['Offset', PcdEntry.GetOffset()],
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
# Package will use ToXml2
|
||||
#
|
||||
#
|
||||
def ToXml2(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['SupModList', GetStringOfList(PcdEntry.GetSupModuleList())]
|
||||
@@ -468,7 +468,7 @@ class PcdEntryXml(object):
|
||||
for Item in PcdEntry.GetPromptList():
|
||||
Tmp = PromptXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
@@ -476,9 +476,9 @@ class PcdEntryXml(object):
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
##
|
||||
# Module will use ToXml3
|
||||
@@ -486,9 +486,9 @@ class PcdEntryXml(object):
|
||||
def ToXml3(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = \
|
||||
[['SupArchList', GetStringOfList(PcdEntry.GetSupArchList())], \
|
||||
['PcdUsage', PcdEntry.GetValidUsage()], \
|
||||
@@ -499,29 +499,29 @@ class PcdEntryXml(object):
|
||||
['TokenSpaceGuidCName', PcdEntry.GetTokenSpaceGuidCName()],
|
||||
['DefaultValue', DefaultValue],
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
##
|
||||
# AsBuild Module will use ToXml4
|
||||
#
|
||||
def ToXml4(self, PcdEntry, Key):
|
||||
if self.PcdCName:
|
||||
pass
|
||||
|
||||
|
||||
DefaultValue = ConvertNEToNOTEQ(PcdEntry.GetDefaultValue())
|
||||
|
||||
|
||||
AttributeList = []
|
||||
|
||||
|
||||
NodeList = [
|
||||
['TokenSpaceGuidValue', PcdEntry.GetTokenSpaceGuidValue()],
|
||||
['PcdCName', PcdEntry.GetCName()],
|
||||
@@ -531,18 +531,18 @@ class PcdEntryXml(object):
|
||||
['Value', DefaultValue],
|
||||
['Offset', PcdEntry.GetOffset()]
|
||||
]
|
||||
|
||||
|
||||
for Item in PcdEntry.GetHelpTextList():
|
||||
Tmp = HelpTextXml()
|
||||
NodeList.append(Tmp.ToXml(Item))
|
||||
for Item in PcdEntry.GetPcdErrorsList():
|
||||
Tmp = PcdErrorXml()
|
||||
NodeList.append(Tmp.ToXml(Item, 'PcdError'))
|
||||
|
||||
|
||||
Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
|
||||
|
||||
|
||||
return Root
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
Str = \
|
||||
|
@@ -1,11 +1,11 @@
|
||||
## @file
|
||||
# This file is used to parse a xml file of .PKG file
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, 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,
|
||||
@@ -89,7 +89,7 @@ class DistributionPackageXml(object):
|
||||
DPLicense = DpHeader.GetLicense()[0][1]
|
||||
else:
|
||||
DPLicense = ''
|
||||
|
||||
|
||||
CheckDict['Name'] = DpHeader.GetName()
|
||||
CheckDict['GUID'] = DpHeader.GetGuid()
|
||||
CheckDict['Version'] = DpHeader.GetVersion()
|
||||
@@ -119,7 +119,7 @@ class DistributionPackageXml(object):
|
||||
ValidateMS(self.DistP.ModuleSurfaceArea[Key], ['DistributionPackage', 'ModuleSurfaceArea'])
|
||||
|
||||
#
|
||||
# Check Each Tool
|
||||
# Check Each Tool
|
||||
#
|
||||
if self.DistP.Tools:
|
||||
XmlTreeLevel = ['DistributionPackage', 'Tools', 'Header']
|
||||
@@ -195,7 +195,7 @@ class DistributionPackageXml(object):
|
||||
ModuleKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
|
||||
self.DistP.ModuleSurfaceArea[ModuleKey] = Module
|
||||
|
||||
#
|
||||
#
|
||||
# Parse Tools
|
||||
#
|
||||
Tmp = MiscellaneousFileXml()
|
||||
@@ -252,7 +252,7 @@ class DistributionPackageXml(object):
|
||||
Msa = ModuleSurfaceAreaXml()
|
||||
DomModule = Msa.ToXml(Module)
|
||||
Root.appendChild(DomModule)
|
||||
#
|
||||
#
|
||||
# Parse Tools
|
||||
#
|
||||
Tmp = MiscellaneousFileXml()
|
||||
@@ -307,7 +307,7 @@ class DistributionPackageXml(object):
|
||||
|
||||
#
|
||||
# Remove SupModList="COMMON" or "common"
|
||||
#
|
||||
#
|
||||
XmlContent = \
|
||||
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
||||
'[\s\r\n]*"', '', XmlContent)
|
||||
@@ -324,7 +324,7 @@ class DistributionPackageXml(object):
|
||||
# Check if any required item is missing in ModuleSurfaceArea
|
||||
#
|
||||
# @param Module: The ModuleSurfaceArea to be checked
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
#
|
||||
def ValidateMS(Module, TopXmlTreeLevel):
|
||||
ValidateMS1(Module, TopXmlTreeLevel)
|
||||
@@ -336,7 +336,7 @@ def ValidateMS(Module, TopXmlTreeLevel):
|
||||
# Check if any required item is missing in ModuleSurfaceArea
|
||||
#
|
||||
# @param Module: The ModuleSurfaceArea to be checked
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
#
|
||||
def ValidateMS1(Module, TopXmlTreeLevel):
|
||||
#
|
||||
@@ -421,10 +421,10 @@ def ValidateMS1(Module, TopXmlTreeLevel):
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
|
||||
#
|
||||
# If SupArchList is used to identify different EntryPoint, UnloadImage, Constructor/Destructor elements and
|
||||
# If SupArchList is used to identify different EntryPoint, UnloadImage, Constructor/Destructor elements and
|
||||
# that SupArchList does not match ModuleSurfaceArea.ModuleProperties:SupArchList, the tool must exit gracefully,
|
||||
# informing the user that the EDK II Build system does not support different EntryPoint, UnloadImage,
|
||||
# Constructor or Destructor elements based on Architecture type. Two SupArchList attributes are considered
|
||||
# informing the user that the EDK II Build system does not support different EntryPoint, UnloadImage,
|
||||
# Constructor or Destructor elements based on Architecture type. Two SupArchList attributes are considered
|
||||
# identical if it lists the same CPU architectures in any order.
|
||||
#
|
||||
for Item in Module.GetExternList():
|
||||
@@ -459,7 +459,7 @@ def ValidateMS1(Module, TopXmlTreeLevel):
|
||||
# Check if any required item is missing in ModuleSurfaceArea
|
||||
#
|
||||
# @param Module: The ModuleSurfaceArea to be checked
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
#
|
||||
def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
#
|
||||
@@ -485,7 +485,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
Logger.Error("UPT", FORMAT_INVALID, ERR_FILE_NAME_INVALIDE % Module.GetModulePath())
|
||||
|
||||
#
|
||||
# Check ModuleProperties->BootMode
|
||||
# Check ModuleProperties->BootMode
|
||||
#
|
||||
XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['BootMode']
|
||||
for Item in Module.GetBootModeList():
|
||||
@@ -494,7 +494,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
|
||||
#
|
||||
# Check ModuleProperties->Event
|
||||
# Check ModuleProperties->Event
|
||||
#
|
||||
XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['Event']
|
||||
for Item in Module.GetEventList():
|
||||
@@ -503,7 +503,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
|
||||
#
|
||||
# Check ModuleProperties->Hob
|
||||
# Check ModuleProperties->Hob
|
||||
#
|
||||
XmlTreeLevel = TopXmlTreeLevel + ['ModuleProperties'] + ['HOB']
|
||||
for Item in Module.GetHobList():
|
||||
@@ -512,8 +512,8 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
|
||||
#
|
||||
# The UDP Specification supports the module type of UEFI_RUNTIME_DRIVER, which is not present in the EDK II INF
|
||||
# File Specification v. 1.23, so UPT must perform the following translation that include the generation of a
|
||||
# The UDP Specification supports the module type of UEFI_RUNTIME_DRIVER, which is not present in the EDK II INF
|
||||
# File Specification v. 1.23, so UPT must perform the following translation that include the generation of a
|
||||
# [Depex] section.
|
||||
#
|
||||
if Module.ModuleType == "UEFI_RUNTIME_DRIVER":
|
||||
@@ -549,7 +549,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
'Usage':Item.GetUsage()}
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
#
|
||||
# If the LibraryClass:SupModList is not "UNDEFINED" the LIBRARY_CLASS entry must have the list
|
||||
# If the LibraryClass:SupModList is not "UNDEFINED" the LIBRARY_CLASS entry must have the list
|
||||
# appended using the format:
|
||||
# LIBRARY_CLASS = <ClassName> ["|" <Edk2ModuleTypeList>]
|
||||
#
|
||||
@@ -574,10 +574,10 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
|
||||
|
||||
#
|
||||
# For Library modules (indicated by a LIBRARY_CLASS statement in the [Defines] section)
|
||||
# If the SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element does not match the Supported Module
|
||||
# Types listed after "LIBRARY_CLASS = <Keyword> |", the tool should gracefully exit with an error message
|
||||
# stating that there is a conflict in the module types the CONSTRUCTOR/DESTRUCTOR is to be used with and
|
||||
# For Library modules (indicated by a LIBRARY_CLASS statement in the [Defines] section)
|
||||
# If the SupModList attribute of the CONSTRUCTOR or DESTRUCTOR element does not match the Supported Module
|
||||
# Types listed after "LIBRARY_CLASS = <Keyword> |", the tool should gracefully exit with an error message
|
||||
# stating that there is a conflict in the module types the CONSTRUCTOR/DESTRUCTOR is to be used with and
|
||||
# the Module types this Library supports.
|
||||
#
|
||||
if IsLibraryModule:
|
||||
@@ -591,10 +591,10 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
RaiseError=True)
|
||||
|
||||
#
|
||||
# If the module is not a library module, the MODULE_TYPE listed in the ModuleSurfaceArea.Header must match the
|
||||
# SupModList attribute. If these conditions cannot be met, the tool must exit gracefully, informing the user
|
||||
# If the module is not a library module, the MODULE_TYPE listed in the ModuleSurfaceArea.Header must match the
|
||||
# SupModList attribute. If these conditions cannot be met, the tool must exit gracefully, informing the user
|
||||
# that the EDK II Build system does not currently support the features required by this Module.
|
||||
#
|
||||
#
|
||||
if not IsLibraryModule:
|
||||
for Item in Module.GetExternList():
|
||||
if hasattr(Item, 'SupModList') and len(Item.SupModList) > 0 and \
|
||||
@@ -628,7 +628,7 @@ def ValidateMS2(Module, TopXmlTreeLevel):
|
||||
# Check if any required item is missing in ModuleSurfaceArea
|
||||
#
|
||||
# @param Module: The ModuleSurfaceArea to be checked
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
# @param XmlTreeLevel: The top level of Module
|
||||
#
|
||||
def ValidateMS3(Module, TopXmlTreeLevel):
|
||||
#
|
||||
@@ -666,12 +666,12 @@ def ValidateMS3(Module, TopXmlTreeLevel):
|
||||
for AsBuilt in Item.GetAsBuiltList():
|
||||
#
|
||||
# Check LibInstance
|
||||
#
|
||||
#
|
||||
if len(AsBuilt.LibraryInstancesList) == 1 and not AsBuilt.LibraryInstancesList[0]:
|
||||
CheckDict = {'GUID':''}
|
||||
XmlTreeLevel = TopXmlTreeLevel + ['BinaryFiles', 'BinaryFile', 'AsBuilt', 'LibraryInstances']
|
||||
IsRequiredItemListNull(CheckDict, XmlTreeLevel)
|
||||
|
||||
|
||||
for LibItem in AsBuilt.LibraryInstancesList:
|
||||
CheckDict = {'Guid':LibItem.Guid,
|
||||
'Version':LibItem.Version}
|
||||
@@ -925,7 +925,7 @@ def ValidatePS2(Package):
|
||||
#
|
||||
# Check if any required item is missing in PackageSurfaceArea
|
||||
#
|
||||
# @param Package: The PackageSurfaceArea to be checked
|
||||
# @param Package: The PackageSurfaceArea to be checked
|
||||
#
|
||||
def ValidatePackageSurfaceArea(Package):
|
||||
ValidatePS1(Package)
|
||||
|
@@ -1,11 +1,11 @@
|
||||
## @file
|
||||
# This file is used to parse a xml file of .PKG file
|
||||
#
|
||||
# Copyright (c) 2011 - 2014, 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,
|
||||
@@ -21,7 +21,7 @@ from Logger.ToolError import PARSER_ERROR
|
||||
import Logger.Log as Logger
|
||||
|
||||
## ConvertVariableName()
|
||||
# Convert VariableName to be L"string",
|
||||
# Convert VariableName to be L"string",
|
||||
# input of UCS-2 format Hex Array or L"string" (C style.) could be converted successfully,
|
||||
# others will not.
|
||||
#
|
||||
@@ -31,11 +31,11 @@ import Logger.Log as Logger
|
||||
def ConvertVariableName(VariableName):
|
||||
VariableName = VariableName.strip()
|
||||
#
|
||||
# check for L quoted string
|
||||
# check for L quoted string
|
||||
#
|
||||
if VariableName.startswith('L"') and VariableName.endswith('"'):
|
||||
return VariableName
|
||||
|
||||
|
||||
#
|
||||
# check for Hex Array, it should be little endian even number of hex numbers
|
||||
#
|
||||
@@ -52,7 +52,7 @@ def ConvertVariableName(VariableName):
|
||||
SecondByte = int(ValueList[Index + 1], 16)
|
||||
if SecondByte != 0:
|
||||
return None
|
||||
|
||||
|
||||
if FirstByte not in xrange(0x20, 0x7F):
|
||||
return None
|
||||
TransferedStr += ('%c')%FirstByte
|
||||
@@ -63,10 +63,10 @@ def ConvertVariableName(VariableName):
|
||||
## IsRequiredItemListNull
|
||||
#
|
||||
# Check if a required XML section item/attribue is NULL
|
||||
#
|
||||
#
|
||||
# @param ItemList: The list of items to be checked
|
||||
# @param XmlTreeLevel: The error message tree level
|
||||
#
|
||||
#
|
||||
def IsRequiredItemListNull(ItemDict, XmlTreeLevel):
|
||||
for Key in ItemDict:
|
||||
if not ItemDict[Key]:
|
||||
@@ -74,7 +74,7 @@ def IsRequiredItemListNull(ItemDict, XmlTreeLevel):
|
||||
ErrorMsg = ERR_XML_PARSER_REQUIRED_ITEM_MISSING % (Key, Msg)
|
||||
Logger.Error('\nUPT', PARSER_ERROR, ErrorMsg, RaiseError=True)
|
||||
|
||||
## Get help text
|
||||
## Get help text
|
||||
#
|
||||
# @param HelpText
|
||||
#
|
||||
@@ -86,8 +86,8 @@ def GetHelpTextList(HelpText):
|
||||
HelpTextObj.SetString(HelT.HelpText)
|
||||
HelpTextList.append(HelpTextObj)
|
||||
return HelpTextList
|
||||
|
||||
## Get Prompt text
|
||||
|
||||
## Get Prompt text
|
||||
#
|
||||
# @param Prompt
|
||||
#
|
||||
|
@@ -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 @@
|
||||
|
||||
'''
|
||||
Xml
|
||||
'''
|
||||
'''
|
||||
|
Reference in New Issue
Block a user