示例#1
0
 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
示例#2
0
 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
示例#3
0
 def FromXml2(self, Item, Key):
     self.UserId = XmlAttribute(XmlNode(Item, '%s' % Key), 'UserId')
     self.Identifier = XmlAttribute(XmlNode(Item, '%s' % Key), 'Identifier')
     UserExtension = UserExtensionObject()
     UserExtension.SetUserID(self.UserId)
     UserExtension.SetIdentifier(self.Identifier)
     return UserExtension
示例#4
0
    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
示例#5
0
 def FromXml(self, Item, Key):
     if Key:
         pass
     self.Usage = XmlAttribute(Item, 'Usage')
     self.SupArchList = \
     [Arch for Arch in GetSplitValueList(XmlAttribute(Item, 'SupArchList'), DataType.TAB_SPACE_SPLIT) if Arch]
     self.SupModList = \
     [Mod for Mod in GetSplitValueList(XmlAttribute(Item, 'SupModList'), DataType.TAB_SPACE_SPLIT) if Mod]
     self.FeatureFlag = ConvertNOTEQToNE(XmlAttribute(Item, 'FeatureFlag'))
示例#6
0
    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
示例#7
0
 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):
        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
示例#9
0
    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
示例#10
0
    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
示例#11
0
    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.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):
        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 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
示例#16
0
 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, 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
示例#18
0
    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
示例#19
0
 def FromXml(self, Item, Key):
     if Key:
         pass
     self.Prompt = XmlElement2(Item, 'Prompt')
     self.Lang = XmlAttribute(Item, 'Lang')
示例#20
0
    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
    def FromXml(self, Item, Key, IsStandAlongModule=False):
        IsBinaryModule = XmlAttribute(Item, 'BinaryModule')
        #
        # Header
        #
        Tmp = HeaderXml()
        Module = Tmp.FromXml(XmlNode(Item, '/%s/Header' % Key), 'Header', True,
                             IsStandAlongModule)
        Module.SetBinaryModule(IsBinaryModule)

        if IsBinaryModule:
            GlobalData.gIS_BINARY_INF = True

        #
        # ModuleProperties
        #
        Tmp = ModulePropertyXml()
        (Module, BootModes, Events, HOBs) = \
        Tmp.FromXml(XmlNode(Item, '/ModuleSurfaceArea/ModuleProperties'), 'ModuleProperties', Module)
        Module.SetBootModeList(BootModes)
        Module.SetEventList(Events)
        Module.SetHobList(HOBs)
        #
        # ClonedFrom
        #
        Tmp = ClonedFromXml()
        ClonedFrom = Tmp.FromXml(
            XmlNode(Item, '/ModuleSurfaceArea/ClonedFrom'), 'ClonedFrom')
        if ClonedFrom:
            Module.SetClonedFrom(ClonedFrom)

        #
        # LibraryClass
        #
        for SubItem in XmlList(
                Item,
                '/ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass'):
            Tmp = LibraryClassXml()
            LibraryClass = Tmp.FromXml(SubItem, 'LibraryClass')
            Module.SetLibraryClassList(Module.GetLibraryClassList() +
                                       [LibraryClass])

        if XmlList(Item, '/ModuleSurfaceArea/LibraryClassDefinitions') and \
           not XmlList(Item, '/ModuleSurfaceArea/LibraryClassDefinitions/LibraryClass'):
            Module.SetLibraryClassList([None])

        #
        # SourceFiles
        #
        for SubItem in XmlList(Item,
                               '/ModuleSurfaceArea/SourceFiles/Filename'):
            Tmp = SourceFileXml()
            SourceFile = Tmp.FromXml(SubItem, 'Filename')
            Module.SetSourceFileList(Module.GetSourceFileList() + [SourceFile])

        if XmlList(Item, '/ModuleSurfaceArea/SourceFiles') and \
           not XmlList(Item, '/ModuleSurfaceArea/SourceFiles/Filename') :
            Module.SetSourceFileList([None])

        #
        # BinaryFile
        #
        for SubItem in XmlList(Item,
                               '/ModuleSurfaceArea/BinaryFiles/BinaryFile'):
            Tmp = BinaryFileXml()
            BinaryFile = Tmp.FromXml(SubItem, 'BinaryFile')
            Module.SetBinaryFileList(Module.GetBinaryFileList() + [BinaryFile])

        if XmlList(Item, '/ModuleSurfaceArea/BinaryFiles') and \
           not XmlList(Item, '/ModuleSurfaceArea/BinaryFiles/BinaryFile') :
            Module.SetBinaryFileList([None])
        #
        # PackageDependencies
        #
        for SubItem in XmlList(
                Item, '/ModuleSurfaceArea/PackageDependencies/Package'):
            Tmp = PackageXml()
            PackageDependency = Tmp.FromXml(SubItem, 'Package')
            Module.SetPackageDependencyList(Module.GetPackageDependencyList() +
                                            [PackageDependency])

        if XmlList(Item, '/ModuleSurfaceArea/PackageDependencies') and \
           not XmlList(Item, '/ModuleSurfaceArea/PackageDependencies/Package'):
            Module.SetPackageDependencyList([None])

        #
        # Guid
        #
        for SubItem in XmlList(Item, '/ModuleSurfaceArea/Guids/GuidCName'):
            Tmp = GuidXml('Module')
            GuidProtocolPpi = Tmp.FromXml(SubItem, 'GuidCName')
            Module.SetGuidList(Module.GetGuidList() + [GuidProtocolPpi])

        if XmlList(Item, '/ModuleSurfaceArea/Guids') and not XmlList(
                Item, '/ModuleSurfaceArea/Guids/GuidCName'):
            Module.SetGuidList([None])

        #
        # Protocol
        #
        for SubItem in XmlList(Item, '/ModuleSurfaceArea/Protocols/Protocol'):
            Tmp = ProtocolXml('Module')
            GuidProtocolPpi = Tmp.FromXml(SubItem, 'Protocol')
            Module.SetProtocolList(Module.GetProtocolList() +
                                   [GuidProtocolPpi])

        if XmlList(Item, '/ModuleSurfaceArea/Protocols') and not XmlList(
                Item, '/ModuleSurfaceArea/Protocols/Protocol'):
            Module.SetProtocolList([None])

        #
        # Ppi
        #
        for SubItem in XmlList(Item, '/ModuleSurfaceArea/PPIs/Ppi'):
            Tmp = PpiXml('Module')
            GuidProtocolPpi = Tmp.FromXml(SubItem, 'Ppi')
            Module.SetPpiList(Module.GetPpiList() + [GuidProtocolPpi])

        if XmlList(Item, '/ModuleSurfaceArea/PPIs') and not XmlList(
                Item, '/ModuleSurfaceArea/PPIs/Ppi'):
            Module.SetPpiList([None])

        #
        # Extern
        #
        for SubItem in XmlList(Item, '/ModuleSurfaceArea/Externs/Extern'):
            Tmp = ExternXml()
            Extern = Tmp.FromXml(SubItem, 'Extern')
            Module.SetExternList(Module.GetExternList() + [Extern])

        if XmlList(Item, '/ModuleSurfaceArea/Externs') and not XmlList(
                Item, '/ModuleSurfaceArea/Externs/Extern'):
            Module.SetExternList([None])

        if not Module.GetBinaryModule():
            #
            # PcdCoded
            #
            for SubItem in XmlList(Item,
                                   '/ModuleSurfaceArea/PcdCoded/PcdEntry'):
                Tmp = PcdEntryXml()
                PcdEntry = Tmp.FromXml3(SubItem, 'PcdEntry')
                Module.SetPcdList(Module.GetPcdList() + [PcdEntry])

            if XmlList(Item, '/ModuleSurfaceArea/PcdCoded') and \
                not XmlList(Item, '/ModuleSurfaceArea/PcdCoded/PcdEntry'):
                Module.SetPcdList([None])

        Module = self.FromXml2(Item, Module)
        #
        # return the module object
        #
        self.Module = Module
        return self.Module
示例#22
0
class DistributionPackageHeaderXml(object):
    def __init__(self):
        self.Header = HeaderXml()
        self.ReadOnly = ''
        self.RePackage = ''
        self.Vendor = ''
        self.Date = ''
        self.Signature = ''
        self.XmlSpecification = ''

    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 ToXml(self, DistributionPackageHeader, Key):
        if self.Header:
            pass
        Element1 = CreateXmlElement('Name', \
                                    DistributionPackageHeader.GetName(), [], \
                                    [['BaseName', \
                                    DistributionPackageHeader.GetBaseName()]])
        Element2 = CreateXmlElement('GUID', \
                                    DistributionPackageHeader.GetGuid(), [], \
                                    [['Version', \
                                    DistributionPackageHeader.GetVersion()]])
        AttributeList = []
        if DistributionPackageHeader.ReadOnly != '':
            AttributeList.append(['ReadOnly', str(DistributionPackageHeader.ReadOnly).lower()])
        if DistributionPackageHeader.RePackage != '':
            AttributeList.append(['RePackage', str(DistributionPackageHeader.RePackage).lower()])
        if DistributionPackageHeader.GetAbstract():
            DPAbstract = DistributionPackageHeader.GetAbstract()[0][1]
        else:
            DPAbstract = ''
        if DistributionPackageHeader.GetDescription():
            DPDescription = DistributionPackageHeader.GetDescription()[0][1]
        else:
            DPDescription = ''
        if DistributionPackageHeader.GetCopyright():
            DPCopyright = DistributionPackageHeader.GetCopyright()[0][1]
        else:
            DPCopyright = ''
        if DistributionPackageHeader.GetLicense():
            DPLicense = DistributionPackageHeader.GetLicense()[0][1]
        else:
            DPLicense = ''
        NodeList = [Element1,
                    Element2,
                    ['Vendor', DistributionPackageHeader.Vendor],
                    ['Date', DistributionPackageHeader.Date],
                    ['Copyright', DPCopyright],
                    ['License', DPLicense],
                    ['Abstract', DPAbstract],
                    ['Description', DPDescription],
                    ['Signature', DistributionPackageHeader.Signature],
                    ['XmlSpecification', \
                     DistributionPackageHeader.XmlSpecification],
                    ]
        Root = CreateXmlElement('%s' % Key, '', NodeList, AttributeList)
        return Root

    def __str__(self):
        return "ReadOnly = %s RePackage = %s Vendor = %s Date = %s \
        Signature = %s XmlSpecification = %s %s" % \
        (self.ReadOnly, self.RePackage, self.Vendor, self.Date, \
         self.Signature, self.XmlSpecification, self.Header)
示例#23
0
 def FromXml(self, Item, Key):
     if Key:
         pass
     self.HelpText = XmlElement2(Item, 'HelpText')
     self.Lang = XmlAttribute(Item, 'Lang')