def FromXml(self, Item, Key): if not Item: return None self.ReadOnly = XmlAttribute(XmlNode(Item, '%s' % Key), 'ReadOnly') self.RePackage = XmlAttribute(XmlNode(Item, '%s' % Key), 'RePackage') self.Vendor = XmlElement(Item, '%s/Vendor' % Key) self.Date = XmlElement(Item, '%s/Date' % Key) self.Signature = XmlElement(Item, '%s/Signature' % Key) self.XmlSpecification = XmlElement(Item, '%s/XmlSpecification' % Key) self.Header.FromXml(Item, Key) DistributionPackageHeader = DistributionPackageHeaderObject() if self.ReadOnly.upper() == 'TRUE': DistributionPackageHeader.ReadOnly = True elif self.ReadOnly.upper() == 'FALSE': DistributionPackageHeader.ReadOnly = False if self.RePackage.upper() == 'TRUE': DistributionPackageHeader.RePackage = True elif self.RePackage.upper() == 'FALSE': DistributionPackageHeader.RePackage = False DistributionPackageHeader.Vendor = self.Vendor DistributionPackageHeader.Date = self.Date DistributionPackageHeader.Signature = self.Signature DistributionPackageHeader.XmlSpecification = self.XmlSpecification DistributionPackageHeader.SetName(self.Header.Name) DistributionPackageHeader.SetBaseName(self.Header.BaseName) DistributionPackageHeader.SetGuid(self.Header.GUID) DistributionPackageHeader.SetVersion(self.Header.Version) DistributionPackageHeader.SetCopyright(self.Header.CopyrightList) DistributionPackageHeader.SetLicense(self.Header.LicenseList) DistributionPackageHeader.SetAbstract(self.Header.AbstractList) DistributionPackageHeader.SetDescription(self.Header.DescriptionList) return DistributionPackageHeader
def FromXml3(self, Item, Key): self.PcdItemType = \ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType') self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage') self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCName' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % 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) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): 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) PcdEntry.SetCName(self.CName) PcdEntry.SetValidUsage(self.PcdUsage) PcdEntry.SetDefaultValue(self.DefaultValue) PcdEntry.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PcdEntry.SetItemType(self.PcdItemType) PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText)) PcdEntry.SetPcdErrorsList(self.PcdError) return PcdEntry
def FromXml(self, Item, Key): self.Target = XmlElement(Item, '%s/Target' % Key) self.TagName = XmlElement(Item, '%s/TagName' % Key) self.Family = XmlElement(Item, '%s/Family' % Key) BuildFlag = BinaryBuildFlagObject() BuildFlag.SetTarget(self.Target) BuildFlag.SetTagName(self.TagName) BuildFlag.SetFamily(self.Family) return BuildFlag
def FromXml(self, Item, Key): if Key: pass if self.UserExtensionBinary: pass Dict = {} for SubItem in XmlList(Item, 'Binaries/Binary'): FileName = XmlElement(SubItem, 'Binary/FileName') FileType = XmlElement(SubItem, 'Binary/FileType') FFE = XmlElement(SubItem, 'Binary/FeatureFlag') SupArch = XmlElement(SubItem, 'Binary/SupArchList') DictKey = (FileName, FileType, ConvertNOTEQToNE(FFE), SupArch) ValueList = [] for ValueNodeItem in XmlList(SubItem, \ 'Binary/BinaryFileOtherAttr'): Target = XmlElement(ValueNodeItem, \ 'BinaryFileOtherAttr/Target') Family = XmlElement(ValueNodeItem, \ 'BinaryFileOtherAttr/Family') TagName = XmlElement(ValueNodeItem, \ 'BinaryFileOtherAttr/TagName') Comment = XmlElement(ValueNodeItem, \ 'BinaryFileOtherAttr/Comment') if (Target == ' ') and (Family == ' ') and \ (TagName == ' ') and (Comment == ' '): Target = '' Family = '' TagName = '' Comment = '' ValueList.append((Target, Family, TagName, Comment)) Dict[DictKey] = ValueList return Dict
def FromXml(self, Item, Key): self.Description = XmlElement(Item, '%s/Description' % Key) self.Guid = XmlElement(Item, '%s/GUID' % Key) self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version') self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key) PackageDependency = PackageDependencyObject() PackageDependency.SetPackage(self.Description) PackageDependency.SetGuid(self.Guid) PackageDependency.SetVersion(self.Version) PackageDependency.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PackageDependency.SetSupArchList(self.CommonDefines.SupArchList) return PackageDependency
def FromXml2(self, Item, Key): if Item is None: return None NewItem = XmlNode(Item, '%s/Header' % Key) self.Header.FromXml(NewItem, 'Header') for SubItem in XmlList(Item, '%s/Filename' % Key): Filename = XmlElement(SubItem, '%s/Filename' % Key) Executable = \ XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'Executable') OsType = XmlAttribute(XmlNode(SubItem, '%s/Filename' % Key), 'OS') if Executable.upper() == "TRUE": Executable = True elif Executable.upper() == "FALSE": Executable = False else: Executable = '' self.Files.append([Filename, Executable, OsType]) MiscFile = MiscFileObject() MiscFile.SetName(self.Header.Name) MiscFile.SetCopyright(self.Header.CopyrightList) MiscFile.SetLicense(self.Header.LicenseList) MiscFile.SetAbstract(self.Header.AbstractList) MiscFile.SetDescription(self.Header.DescriptionList) MiscFileList = [] for File in self.Files: FileObj = FileObject() FileObj.SetURI(File[0]) FileObj.SetExecutable(File[1]) FileObj.SetOS(File[2]) MiscFileList.append(FileObj) MiscFile.SetFileList(MiscFileList) return MiscFile
def FromXml(self, Item, Key): self.CommonDefines.FromXml(Item, Key) self.EntryPoint = XmlElement(Item, '%s/EntryPoint' % Key) self.UnloadImage = XmlElement(Item, '%s/UnloadImage' % Key) self.Constructor = XmlElement(Item, '%s/Constructor' % Key) self.Destructor = XmlElement(Item, '%s/Destructor' % Key) Extern = ExternObject() Extern.SetEntryPoint(self.EntryPoint) Extern.SetUnloadImage(self.UnloadImage) Extern.SetConstructor(self.Constructor) Extern.SetDestructor(self.Destructor) if self.CommonDefines.SupModList: Extern.SetSupModList(self.CommonDefines.SupModList) if self.CommonDefines.SupArchList: Extern.SetSupArchList(self.CommonDefines.SupArchList) return Extern
def FromXml(self, Item, Key): if Key: pass if self.UserExtensionSource: pass Dict = {} #SourcesItem = XmlNode(Item, '%s/Sources' % Key) for SubItem in XmlList(Item, 'Sources/SourceFile'): FileName = XmlElement(SubItem, 'SourceFile/FileName') Family = XmlElement(SubItem, 'SourceFile/Family') FeatureFlag = XmlElement(SubItem, 'SourceFile/FeatureFlag') SupArchStr = XmlElement(SubItem, 'SourceFile/SupArchList') DictKey = (FileName, Family, FeatureFlag, SupArchStr) ValueList = [] for ValueNodeItem in XmlList(SubItem, \ 'SourceFile/SourceFileOtherAttr'): TagName = XmlElement(ValueNodeItem, \ 'SourceFileOtherAttr/TagName') ToolCode = XmlElement(ValueNodeItem, \ 'SourceFileOtherAttr/ToolCode') Comment = XmlElement(ValueNodeItem, \ 'SourceFileOtherAttr/Comment') if (TagName == ' ') and (ToolCode == ' ') and (Comment == ' '): TagName = '' ToolCode = '' Comment = '' ValueList.append((TagName, ToolCode, Comment)) Dict[DictKey] = ValueList return Dict
def FromXml(self, Item, Key): self.GUID = XmlElement(Item, '%s/GUID' % Key) self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version') if self.GUID == '' and self.Version == '': return None ClonedFrom = ClonedRecordObject() ClonedFrom.SetPackageGuid(self.GUID) ClonedFrom.SetPackageVersion(self.Version) return ClonedFrom
def FromXml(self, Item, Key): self.Keyword = XmlAttribute(XmlNode(Item, '%s' % Key), 'Keyword') if self.Keyword == '': self.Keyword = XmlElement(Item, '%s/Keyword' % Key) self.HeaderFile = XmlElement(Item, '%s/HeaderFile' % 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) self.HelpText.append(HelpTextObj) LibraryClass = LibraryClassObject() LibraryClass.SetLibraryClass(self.Keyword) LibraryClass.SetIncludeHeader(self.HeaderFile) if self.CommonDefines.Usage: LibraryClass.SetUsage(self.CommonDefines.Usage) LibraryClass.SetSupArchList(self.CommonDefines.SupArchList) LibraryClass.SetSupModuleList(self.CommonDefines.SupModList) LibraryClass.SetFeatureFlag(ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) LibraryClass.SetHelpTextList(GetHelpTextList(self.HelpText)) return LibraryClass
def FromXml(self, Item, Key): if self.FileNames: pass BinaryFile = BinaryFileObject() FilenameList = [] SupArchList = ['COMMON'] for SubItem in XmlList(Item, '%s/Filename' % Key): Axml = FilenameXml() Bxml = Axml.FromXml(SubItem, 'Filename') FilenameList.append(Bxml) BinaryFile.SetFileNameList(FilenameList) for FileName in FilenameList: if FileName.GetSupArchList(): SupArchList = FileName.GetSupArchList() BinaryFile.SetSupArchList(SupArchList) if GlobalData.gIS_BINARY_INF: AsBuiltList = [] for AsBuiltItem in XmlList(Item, '%s/AsBuilt' % Key): AsBuilt = AsBuiltObject() PatchPcdValueList = [] for SubItem in XmlList(AsBuiltItem, 'AsBuilt/PatchPcdValue'): Axml = PcdEntryXml() Bxml = Axml.FromXml(SubItem, 'PatchPcdValue') PatchPcdValueList.append(Bxml) AsBuilt.SetPatchPcdList(PatchPcdValueList) PcdExValueList = [] for SubItem in XmlList(AsBuiltItem, 'AsBuilt/PcdExValue'): Axml = PcdEntryXml() Bxml = Axml.FromXml(SubItem, 'PcdExValue') PcdExValueList.append(Bxml) AsBuilt.SetPcdExList(PcdExValueList) LibraryList = [] for SubItem in XmlList( Item, '%s/AsBuilt/LibraryInstances/GUID' % Key): GuidVerObj = GuidVersionObject() GUID = XmlElement(SubItem, 'GUID') Version = XmlAttribute(XmlNode(SubItem, 'GUID'), 'Version') GuidVerObj.SetGuid(GUID) GuidVerObj.SetVersion(Version) LibraryList.append(GuidVerObj) if XmlList(Item, '%s/AsBuilt/LibraryInstances' % Key) and not LibraryList: LibraryList = [None] AsBuilt.SetLibraryInstancesList(LibraryList) BuildFlagList = [] for SubItem in XmlList(Item, '%s/AsBuilt/BuildFlags' % Key): BuildFlag = BuildFlagXml() BuildFlagList.append( BuildFlag.FromXml2(SubItem, 'BuildFlags')) AsBuilt.SetBuildFlagsList(BuildFlagList) AsBuiltList.append(AsBuilt) BinaryFile.SetAsBuiltList(AsBuiltList) return BinaryFile
def FromXml(self, Item, Key): self.UiName = XmlAttribute(XmlNode(Item, '%s' % Key), 'UiName') self.GuidType = XmlAttribute(XmlNode(Item, '%s' % Key), 'GuidType') self.Notify = XmlAttribute(XmlNode(Item, '%s' % Key), 'Notify') self.CName = XmlElement(Item, '%s/CName' % Key) self.GuidValue = XmlElement(Item, '%s/GuidValue' % Key) self.VariableName = XmlElement(Item, '%s/VariableName' % 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) self.HelpText.append(HelpTextObj) if self.Type == 'Guid': GuidProtocolPpi = GuidObject() elif self.Type == 'Protocol': GuidProtocolPpi = ProtocolObject() else: GuidProtocolPpi = PpiObject() GuidProtocolPpi.SetHelpTextList(GetHelpTextList(self.HelpText)) return GuidProtocolPpi
def FromXml(self, Item, Key): self.ValidValueList = XmlElement(Item, '%s/ValidValueList' % Key) self.ValidValueListLang = \ XmlAttribute(XmlNode(Item, '%s/ValidValueList' % Key), 'Lang') self.ValidValueRange = self.TransferValidEpxr2ValidRange( XmlElement(Item, '%s/ValidValueRange' % Key)) self.Expression = XmlElement(Item, '%s/Expression' % Key) self.ErrorNumber = XmlElement(Item, '%s/ErrorNumber' % Key) for ErrMsg in XmlList(Item, '%s/ErrorMessage' % Key): ErrorMessageString = XmlElement(ErrMsg, 'ErrorMessage') ErrorMessageLang = \ XmlAttribute(XmlNode(ErrMsg, 'ErrorMessage'), 'Lang') self.ErrorMessage.append((ErrorMessageLang, ErrorMessageString)) Error = PcdErrorObject() Error.SetValidValue(self.ValidValueList) Error.SetValidValueLang(self.ValidValueListLang) Error.SetValidValueRange(self.ValidValueRange) Error.SetExpression(self.Expression) Error.SetErrorNumber(self.ErrorNumber) Error.SetErrorMessageList(self.ErrorMessage) return Error
def FromXml(self, Item, Key): self.SupportedBootModes = \ XmlElement(Item, '%s/SupportedBootModes' % Key) self.CommonDefines.FromXml(Item, Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) BootMode = BootModeObject() BootMode.SetSupportedBootModes(self.SupportedBootModes) BootMode.SetUsage(self.CommonDefines.Usage) BootMode.SetHelpTextList(GetHelpTextList(self.HelpText)) return BootMode
def FromXml(self, Item, Key): self.EventType = XmlAttribute(XmlNode(Item, '%s' % Key), 'EventType') self.Name = XmlElement(Item, '%s' % Key) self.CommonDefines.FromXml(Item, Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) Event = EventObject() Event.SetEventType(self.EventType) Event.SetUsage(self.CommonDefines.Usage) Event.SetHelpTextList(GetHelpTextList(self.HelpText)) return Event
def FromXml(self, Item, Key): self.ToolChainFamily = XmlAttribute(Item, 'Family') self.SourceFile = XmlElement(Item, 'Filename') self.CommonDefines.FromXml(Item, Key) self.CommonDefines.FeatureFlag = ConvertNOTEQToNE( self.CommonDefines.FeatureFlag) SourceFile = SourceFileObject() SourceFile.SetSourceFile(self.SourceFile) SourceFile.SetFamily(self.ToolChainFamily) SourceFile.SetSupArchList(self.CommonDefines.SupArchList) SourceFile.SetFeatureFlag(self.CommonDefines.FeatureFlag) return SourceFile
def FromXml(self, Item, Key, PackageObject2): if not Item: XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea'] CheckDict = {'PackageHeader': None, } IsRequiredItemListNull(CheckDict, XmlTreeLevel) self.PackagePath = XmlElement(Item, '%s/PackagePath' % Key) self.Header.FromXml(Item, Key) PackageObject2.SetName(self.Header.Name) PackageObject2.SetBaseName(self.Header.BaseName) PackageObject2.SetGuid(self.Header.GUID) PackageObject2.SetVersion(self.Header.Version) PackageObject2.SetCopyright(self.Header.CopyrightList) PackageObject2.SetLicense(self.Header.LicenseList) PackageObject2.SetAbstract(self.Header.AbstractList) PackageObject2.SetDescription(self.Header.DescriptionList) PackageObject2.SetPackagePath(self.PackagePath)
def FromXml(self, Item, Key): self.HobType = XmlAttribute(XmlNode(Item, '%s' % Key), 'HobType') self.Name = XmlElement(Item, '%s' % Key) self.CommonDefines.FromXml(Item, Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) Hob = HobObject() Hob.SetHobType(self.HobType) Hob.SetSupArchList(self.CommonDefines.SupArchList) Hob.SetUsage(self.CommonDefines.Usage) Hob.SetHelpTextList(GetHelpTextList(self.HelpText)) return Hob
def FromXml2(self, Item, Key): self.AsBuiltFlags = XmlElement(Item, '%s' % Key) LineList = GetSplitValueList(self.AsBuiltFlags, '\n') ReturnLine = '' Count = 0 for Line in LineList: if Count == 0: ReturnLine = "# " + Line else: ReturnLine = ReturnLine + '\n' + '# ' + Line Count += 1 BuildFlag = BinaryBuildFlagObject() BuildFlag.SetAsBuiltOptionFlags(ReturnLine) return BuildFlag
def FromXml(self, Item, Key): if not Item: return None self.CommonDefines.FromXml(Item, Key) self.Expression = XmlElement(Item, '%s/Expression' % Key) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) Depex = DepexObject() Depex.SetDepex(self.Expression) Depex.SetModuleType(self.CommonDefines.SupModList) Depex.SetSupArchList(self.CommonDefines.SupArchList) Depex.SetFeatureFlag(self.CommonDefines.FeatureFlag) Depex.SetHelpTextList(GetHelpTextList(self.HelpText)) return Depex
def FromXml(self, Item, Key): self.FileType = XmlAttribute(Item, 'FileType') Guid = XmlAttribute(Item, 'GUID') self.Filename = XmlElement(Item, 'Filename') self.CommonDefines.FromXml(Item, Key) FeatureFlag = ConvertNOTEQToNE(self.CommonDefines.FeatureFlag) Filename = FileNameObject() # # Convert File Type # if self.FileType == 'UEFI_IMAGE': self.FileType = 'PE32' Filename.SetGuidValue(Guid) Filename.SetFileType(self.FileType) Filename.SetFilename(self.Filename) Filename.SetSupArchList(self.CommonDefines.SupArchList) Filename.SetFeatureFlag(FeatureFlag) return Filename
def FromXml2(self, Item, Key): self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key) self.Token = XmlElement(Item, '%s/Token' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.DatumType = XmlElement(Item, '%s/DatumType' % Key) self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key) self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key) self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key) self.CommonDefines.FromXml(XmlNode(Item, '%s' % Key), Key) for PromptItem in XmlList(Item, '%s/Prompt' % Key): PromptObj = PromptXml() PromptObj.FromXml(PromptItem, '%s/Prompt' % Key) self.Prompt.append(PromptObj) for HelpTextItem in XmlList(Item, '%s/HelpText' % Key): HelpTextObj = HelpTextXml() HelpTextObj.FromXml(HelpTextItem, '%s/HelpText' % Key) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): 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) PcdEntry.SetTokenSpaceGuidCName(self.TokenSpaceGuidCName) PcdEntry.SetToken(self.Token) PcdEntry.SetCName(self.CName) PcdEntry.SetDatumType(self.DatumType) PcdEntry.SetValidUsage(self.ValidUsage) 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
def FromXml(self, Item, Key, Header=None): self.CommonDefines.FromXml(Item, Key) self.ModuleType = XmlElement(Item, '%s/ModuleType' % Key) self.Path = XmlElement(Item, '%s/Path' % Key) self.PcdIsDriver = XmlElement(Item, '%s/PcdIsDriver' % Key) self.UefiSpecificationVersion = XmlElement( Item, '%s/UefiSpecificationVersion' % Key) self.PiSpecificationVersion = XmlElement( Item, '%s/PiSpecificationVersion' % Key) for SubItem in XmlList(Item, '%s/Specification' % Key): Specification = XmlElement(SubItem, '/Specification') Version = XmlAttribute(XmlNode(SubItem, '/Specification'), 'Version') self.SpecificationList.append((Specification, Version)) for SubItem in XmlList(Item, '%s/BootMode' % Key): Axml = BootModeXml() BootMode = Axml.FromXml(SubItem, 'BootMode') self.BootModes.append(BootMode) for SubItem in XmlList(Item, '%s/Event' % Key): Axml = EventXml() Event = Axml.FromXml(SubItem, 'Event') self.Events.append(Event) for SubItem in XmlList(Item, '%s/HOB' % Key): Axml = HobXml() Hob = Axml.FromXml(SubItem, 'HOB') self.HOBs.append(Hob) if Header is None: Header = ModuleObject() Header.SetModuleType(self.ModuleType) Header.SetSupArchList(self.CommonDefines.SupArchList) Header.SetModulePath(self.Path) Header.SetPcdIsDriver(self.PcdIsDriver) Header.SetUefiSpecificationVersion(self.UefiSpecificationVersion) Header.SetPiSpecificationVersion(self.PiSpecificationVersion) Header.SetSpecList(self.SpecificationList) return Header, self.BootModes, self.Events, self.HOBs
def FromXml(self, Item, Key, IsRequiredCheck=False, IsStandAlongModule=False): if not Item and IsRequiredCheck: XmlTreeLevel = [] if IsStandAlongModule: XmlTreeLevel = ['DistributionPackage', 'ModuleSurfaceArea'] else: XmlTreeLevel = ['DistributionPackage', 'PackageSurfaceArea', 'ModuleSurfaceArea'] CheckDict = {'Header':''} IsRequiredItemListNull(CheckDict, XmlTreeLevel) self.Name = XmlElement(Item, '%s/Name' % Key) self.BaseName = XmlAttribute(XmlNode(Item, '%s/Name' % Key), 'BaseName') self.GUID = XmlElement(Item, '%s/GUID' % Key) self.Version = XmlAttribute(XmlNode(Item, '%s/GUID' % Key), 'Version') for SubItem in XmlList(Item, '%s/Abstract' % Key): HeaderAbstractLang = XmlAttribute(SubItem, 'Lang') self.AbstractList.append((HeaderAbstractLang, XmlElement(SubItem, '%s/Abstract' % Key))) for SubItem in XmlList(Item, '%s/Description' % Key): HeaderDescriptionLang = XmlAttribute(SubItem, 'Lang') self.DescriptionList.append((HeaderDescriptionLang, XmlElement(SubItem, '%s/Description' % Key))) for SubItem in XmlList(Item, '%s/Copyright' % Key): HeaderCopyrightLang = XmlAttribute(SubItem, 'Lang') 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))) ModuleHeader = ModuleObject() ModuleHeader.SetName(self.Name) ModuleHeader.SetBaseName(self.BaseName) ModuleHeader.SetGuid(self.GUID) ModuleHeader.SetVersion(self.Version) ModuleHeader.SetCopyright(self.CopyrightList) ModuleHeader.SetLicense(self.LicenseList) ModuleHeader.SetAbstract(self.AbstractList) ModuleHeader.SetDescription(self.DescriptionList) return ModuleHeader
def FromXml(self, Item, Key): self.PcdItemType = \ XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdItemType') self.PcdUsage = XmlAttribute(XmlNode(Item, '%s' % Key), 'PcdUsage') self.TokenSpaceGuidCName = \ XmlElement(Item, '%s/TokenSpaceGuidCname' % Key) self.TokenSpaceGuidValue = \ XmlElement(Item, '%s/TokenSpaceGuidValue' % Key) self.Token = XmlElement(Item, '%s/Token' % Key) self.CName = XmlElement(Item, '%s/CName' % Key) self.PcdCName = XmlElement(Item, '%s/PcdCName' % Key) self.DatumType = XmlElement(Item, '%s/DatumType' % Key) self.ValidUsage = XmlElement(Item, '%s/ValidUsage' % Key) if not GlobalData.gIS_BINARY_INF: self.DefaultValue = XmlElement(Item, '%s/DefaultValue' % Key) else: self.DefaultValue = XmlElement(Item, '%s/Value' % Key) self.MaxDatumSize = XmlElement(Item, '%s/MaxDatumSize' % Key) 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) self.HelpText.append(HelpTextObj) for PcdErrorItem in XmlList(Item, '%s/PcdError' % Key): 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) PcdEntry.SetTokenSpaceGuidValue(self.TokenSpaceGuidValue) PcdEntry.SetToken(self.Token) PcdEntry.SetOffset(self.Offset) PcdEntry.SetCName(self.CName) PcdEntry.SetPcdCName(self.PcdCName) PcdEntry.SetDatumType(self.DatumType) PcdEntry.SetValidUsage(self.ValidUsage) PcdEntry.SetDefaultValue(self.DefaultValue) PcdEntry.SetMaxDatumSize(self.MaxDatumSize) PcdEntry.SetFeatureFlag( ConvertNOTEQToNE(self.CommonDefines.FeatureFlag)) PcdEntry.SetItemType(self.PcdItemType) PcdEntry.SetHelpTextList(GetHelpTextList(self.HelpText)) PcdEntry.SetPcdErrorsList(self.PcdError) return PcdEntry
def FromXml(self, Item, Key): self.UserId = XmlAttribute(XmlNode(Item, '%s' % Key), 'UserId') self.Identifier = XmlAttribute(XmlNode(Item, '%s' % Key), 'Identifier') if self.UserId == DataType.TAB_BINARY_HEADER_USERID \ and self.Identifier == DataType.TAB_BINARY_HEADER_IDENTIFIER: for SubItem in XmlList(Item, '%s/BinaryAbstract' % Key): BinaryAbstractLang = XmlAttribute(SubItem, 'Lang') 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, XmlElement(SubItem, '%s/BinaryDescription' % Key))) for SubItem in XmlList(Item, '%s/BinaryCopyright' % Key): BinaryCopyrightLang = XmlAttribute(SubItem, 'Lang') 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))) DefineItem = XmlNode(Item, '%s/Define' % Key) for SubItem in XmlList(DefineItem, 'Define/Statement'): Statement = XmlElement(SubItem, '%s/Statement' % Key) self.DefineDict[Statement] = "" BuildOptionItem = XmlNode(Item, '%s/BuildOption' % Key) for SubItem in XmlList(BuildOptionItem, 'BuildOption/Statement'): Statement = XmlElement(SubItem, '%s/Statement' % Key) Arch = XmlAttribute(XmlNode(SubItem, '%s/Statement' % Key), 'SupArchList') self.BuildOptionDict[Arch] = Statement IncludesItem = XmlNode(Item, '%s/Includes' % Key) for SubItem in XmlList(IncludesItem, 'Includes/Statement'): Statement = XmlElement(SubItem, '%s/Statement' % Key) Arch = XmlAttribute(XmlNode(SubItem, '%s/Statement' % Key), 'SupArchList') self.IncludesDict[Statement] = Arch SourcesItem = XmlNode(Item, '%s/Sources' % Key) Tmp = UserExtensionSourceXml() SourceDict = Tmp.FromXml(SourcesItem, 'Sources') self.SourcesDict = SourceDict BinariesItem = XmlNode(Item, '%s/Binaries' % Key) Tmp = UserExtensionBinaryXml() BinariesDict = Tmp.FromXml(BinariesItem, 'Binaries') self.BinariesDict = BinariesDict self.Statement = XmlElement(Item, 'UserExtensions') SupArch = XmlAttribute(XmlNode(Item, '%s' % Key), 'SupArchList') self.SupArchList = [Arch for Arch in GetSplitValueList(SupArch, DataType.TAB_SPACE_SPLIT) if Arch] UserExtension = UserExtensionObject() UserExtension.SetUserID(self.UserId) UserExtension.SetIdentifier(self.Identifier) UserExtension.SetBinaryAbstract(self.BinaryAbstractList) UserExtension.SetBinaryDescription(self.BinaryDescriptionList) UserExtension.SetBinaryCopyright(self.BinaryCopyrightList) UserExtension.SetBinaryLicense(self.BinaryLicenseList) UserExtension.SetStatement(self.Statement) UserExtension.SetSupArchList(self.SupArchList) UserExtension.SetDefinesDict(self.DefineDict) UserExtension.SetBuildOptionDict(self.BuildOptionDict) UserExtension.SetIncludesDict(self.IncludesDict) UserExtension.SetSourcesDict(self.SourcesDict) UserExtension.SetBinariesDict(self.BinariesDict) return UserExtension