Ejemplo n.º 1
0
def PrepareTest(String):
    SectionString = StringToSectionString(String)
    ItemList = []
    for Item in SectionString:
        ValueList = Item[0].split('|')
        for count in range(len(ValueList)):
            ValueList[count] = ValueList[count].strip()
        if len(ValueList) >= 2:
            #
            # Create a temp file for test.
            #
            FileName = os.path.normpath(os.path.realpath(ValueList[1].strip()))
            try:
                TempFile = open(FileName, "w")
                TempFile.close()
            except:
                print("File Create Error")
        CurrentLine = CurrentLine()
        CurrentLine.SetFileName("Test")
        CurrentLine.SetLineString(Item[0])
        CurrentLine.SetLineNo(Item[1])
        InfLineCommentObject = InfLineCommentObject()

        ItemList.append((ValueList, InfLineCommentObject, CurrentLine))

    return ItemList
Ejemplo n.º 2
0
 def SetDefines(self, DefineContent, Arch=None):
     #
     # Validate Arch
     #
     HasFoundInfVersionFalg = False
     LineInfo = ['', -1, '']
     ArchListString = ' '.join(Arch)
     #
     # Parse Define items.
     #
     for InfDefMemberObj in DefineContent:
         ProcessFunc = None
         Name = InfDefMemberObj.GetName()
         Value = InfDefMemberObj.GetValue()
         if Name == DT.TAB_INF_DEFINES_MODULE_UNI_FILE:
             ValidateUNIFilePath(Value)
             Value = os.path.join(
                 os.path.dirname(InfDefMemberObj.CurrentLine.FileName),
                 Value)
             if not os.path.isfile(Value) or not os.path.exists(Value):
                 LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
                 LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
                 LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
                 ErrorInInf(
                     ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID %
                     (Name),
                     LineInfo=LineInfo)
         InfLineCommentObj = InfLineCommentObject()
         InfLineCommentObj.SetHeaderComments(
             InfDefMemberObj.Comments.GetHeaderComments())
         InfLineCommentObj.SetTailComments(
             InfDefMemberObj.Comments.GetTailComments())
         if Name == 'COMPONENT_TYPE':
             ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
                        ErrorCode=ToolError.EDK1_INF_ERROR,
                        RaiseError=True)
         if Name == DT.TAB_INF_DEFINES_INF_VERSION:
             HasFoundInfVersionFalg = True
         if not (Name == '' or Name == None):
             #
             # Process "SPEC" Keyword definition.
             #
             ReName = re.compile(r"SPEC ", re.DOTALL)
             if ReName.match(Name):
                 SpecValue = Name[Name.find("SPEC") + len("SPEC"):].strip()
                 Name = "SPEC"
                 Value = SpecValue + " = " + Value
             if self.Defines.has_key(ArchListString):
                 DefineList = self.Defines[ArchListString]
                 LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
                 LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
                 LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
                 DefineList.CurrentLine = LineInfo
                 #
                 # Found the process function from mapping table.
                 #
                 if Name not in gFUNCTION_MAPPING_FOR_DEFINE_SECTION.keys():
                     ErrorInInf(
                         ST.ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID %
                         (Name),
                         LineInfo=LineInfo)
                 else:
                     ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[
                         Name]
                 if (ProcessFunc != None):
                     ProcessFunc(DefineList, Value, InfLineCommentObj)
                 self.Defines[ArchListString] = DefineList
             else:
                 DefineList = InfDefSection()
                 LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
                 LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
                 LineInfo[2] = InfDefMemberObj.CurrentLine.GetLineString()
                 DefineList.CurrentLine = LineInfo
                 #
                 # Found the process function from mapping table.
                 #
                 if Name not in gFUNCTION_MAPPING_FOR_DEFINE_SECTION.keys():
                     ErrorInInf(
                         ST.ERR_INF_PARSER_DEFINE_SECTION_KEYWORD_INVALID %
                         (Name),
                         LineInfo=LineInfo)
                 #
                 # Found the process function from mapping table.
                 #
                 else:
                     ProcessFunc = gFUNCTION_MAPPING_FOR_DEFINE_SECTION[
                         Name]
                 if (ProcessFunc != None):
                     ProcessFunc(DefineList, Value, InfLineCommentObj)
                 self.Defines[ArchListString] = DefineList
     #
     # After set, check whether INF_VERSION defined.
     #
     if not HasFoundInfVersionFalg:
         ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
                    ErrorCode=ToolError.EDK1_INF_ERROR,
                    RaiseError=True)
     return True
Ejemplo n.º 3
0
 def __init__(self, Name='', Value=''):
     self.Comments = InfLineCommentObject()
     self.Name = Name
     self.Value = Value
     self.CurrentLine = CurrentLine()
Ejemplo n.º 4
0
    def InfPackageParser(self, SectionString, InfSectionObject, FileName):
        #
        # Macro defined in this section
        #
        SectionMacros = {}
        ValueList = []
        PackageList = []
        StillCommentFalg = False
        HeaderComments = []
        LineComment = None
        #
        # Parse section content
        #
        for Line in SectionString:
            PkgLineContent = Line[0]
            PkgLineNo = Line[1]

            if PkgLineContent.strip() == '':
                continue

            #
            # Find Header Comments
            #
            if PkgLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
                #
                # Last line is comments, and this line go on.
                #
                if StillCommentFalg:
                    HeaderComments.append(Line)
                    continue
                #
                # First time encounter comment
                #
                else:
                    #
                    # Clear original data
                    #
                    HeaderComments = []
                    HeaderComments.append(Line)
                    StillCommentFalg = True
                    continue
            else:
                StillCommentFalg = False

            if len(HeaderComments) >= 1:
                LineComment = InfLineCommentObject()
                LineCommentContent = ''
                for Item in HeaderComments:
                    LineCommentContent += Item[0] + DT.END_OF_LINE
                LineComment.SetHeaderComments(LineCommentContent)

            #
            # Find Tail comment.
            #
            if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
                TailComments = PkgLineContent[PkgLineContent.
                                              find(DT.TAB_COMMENT_SPLIT):]
                PkgLineContent = PkgLineContent[:PkgLineContent.
                                                find(DT.TAB_COMMENT_SPLIT)]
                if LineComment is None:
                    LineComment = InfLineCommentObject()
                LineComment.SetTailComments(TailComments)
            #
            # Find Macro
            #
            Name, Value = MacroParser((PkgLineContent, PkgLineNo), FileName,
                                      DT.MODEL_META_DATA_PACKAGE,
                                      self.FileLocalMacros)
            if Name is not None:
                SectionMacros[Name] = Value
                LineComment = None
                HeaderComments = []
                continue

            TokenList = GetSplitValueList(PkgLineContent, DT.TAB_VALUE_SPLIT,
                                          1)
            ValueList[0:len(TokenList)] = TokenList

            #
            # Replace with Local section Macro and [Defines] section Macro.
            #
            ValueList = [
                InfExpandMacro(Value, (FileName, PkgLineContent, PkgLineNo),
                               self.FileLocalMacros, SectionMacros, True)
                for Value in ValueList
            ]

            PackageList.append((ValueList, LineComment, (PkgLineContent,
                                                         PkgLineNo, FileName)))
            ValueList = []
            LineComment = None
            TailComments = ''
            HeaderComments = []
            continue

        #
        # Current section archs
        #
        ArchList = []
        for Item in self.LastSectionHeaderContent:
            if Item[1] not in ArchList:
                ArchList.append(Item[1])

        if not InfSectionObject.SetPackages(PackageList, Arch=ArchList):
            Logger.Error('InfParser',
                         FORMAT_INVALID,
                         ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR\
                         %("[Packages]"),
                         File=FileName,
                         Line=Item[3])
    def InfSourceParser(self, SectionString, InfSectionObject, FileName):
        SectionMacros = {}
        ValueList = []
        SourceList = []
        StillCommentFalg = False
        HeaderComments = []
        LineComment = None
        SectionContent = ''
        for Line in SectionString:
            SrcLineContent = Line[0]
            SrcLineNo = Line[1]

            if SrcLineContent.strip() == '':
                continue

            #
            # Found Header Comments
            #
            if SrcLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
                #
                # Last line is comments, and this line go on.
                #
                if StillCommentFalg:
                    HeaderComments.append(Line)
                    SectionContent += SrcLineContent + DT.END_OF_LINE
                    continue
                #
                # First time encounter comment
                #
                else:
                    #
                    # Clear original data
                    #
                    HeaderComments = []
                    HeaderComments.append(Line)
                    StillCommentFalg = True
                    SectionContent += SrcLineContent + DT.END_OF_LINE
                    continue
            else:
                StillCommentFalg = False

            if len(HeaderComments) >= 1:
                LineComment = InfLineCommentObject()
                LineCommentContent = ''
                for Item in HeaderComments:
                    LineCommentContent += Item[0] + DT.END_OF_LINE
                LineComment.SetHeaderComments(LineCommentContent)

            #
            # Find Tail comment.
            #
            if SrcLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
                TailComments = SrcLineContent[SrcLineContent.
                                              find(DT.TAB_COMMENT_SPLIT):]
                SrcLineContent = SrcLineContent[:SrcLineContent.
                                                find(DT.TAB_COMMENT_SPLIT)]
                if LineComment is None:
                    LineComment = InfLineCommentObject()
                LineComment.SetTailComments(TailComments)

            #
            # Find Macro
            #
            Name, Value = MacroParser((SrcLineContent, SrcLineNo), FileName,
                                      DT.MODEL_EFI_SOURCE_FILE,
                                      self.FileLocalMacros)
            if Name is not None:
                SectionMacros[Name] = Value
                LineComment = None
                HeaderComments = []
                continue

            #
            # Replace with Local section Macro and [Defines] section Macro.
            #
            SrcLineContent = InfExpandMacro(
                SrcLineContent, (FileName, SrcLineContent, SrcLineNo),
                self.FileLocalMacros, SectionMacros)

            TokenList = GetSplitValueList(SrcLineContent, DT.TAB_VALUE_SPLIT,
                                          4)
            ValueList[0:len(TokenList)] = TokenList

            #
            # Store section content string after MACRO replaced.
            #
            SectionContent += SrcLineContent + DT.END_OF_LINE

            SourceList.append((ValueList, LineComment, (SrcLineContent,
                                                        SrcLineNo, FileName)))
            ValueList = []
            LineComment = None
            TailComments = ''
            HeaderComments = []
            continue

        #
        # Current section archs
        #
        ArchList = []
        for Item in self.LastSectionHeaderContent:
            if Item[1] not in ArchList:
                ArchList.append(Item[1])
                InfSectionObject.SetSupArchList(Item[1])

        InfSectionObject.SetAllContent(SectionContent)
        if not InfSectionObject.SetSources(SourceList, Arch=ArchList):
            Logger.Error('InfParser',
                         FORMAT_INVALID,
                         ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR %
                         ("[Sources]"),
                         File=FileName,
                         Line=Item[3])
Ejemplo n.º 6
0
    def InfDefineParser(self, SectionString, InfSectionObject, FileName,
                        SectionComment):

        if SectionComment:
            pass
        #
        # Parser Defines section content and fill self._ContentList dict.
        #
        StillCommentFalg = False
        HeaderComments = []
        SectionContent = ''
        ArchList = []
        _ContentList = []
        _ValueList = []
        #
        # Add WORKSPACE to global Marco dict.
        #
        self.FileLocalMacros['WORKSPACE'] = GlobalData.gWORKSPACE

        for Line in SectionString:
            LineContent = Line[0]
            LineNo = Line[1]
            TailComments = ''
            LineComment = None

            LineInfo = ['', -1, '']
            LineInfo[0] = FileName
            LineInfo[1] = LineNo
            LineInfo[2] = LineContent

            if LineContent.strip() == '':
                continue
            #
            # The first time encountered VALIDATE_ARCHITECHERS will be considered as support arch list.
            #
            if not ArchList:
                ArchList = GetValidateArchList(LineContent)

            #
            # Parser Comment
            #
            if LineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
                #
                # Last line is comments, and this line go on.
                #
                if StillCommentFalg:
                    HeaderComments.append(Line)
                    SectionContent += LineContent + DT.END_OF_LINE
                    continue
                #
                # First time encounter comment
                #
                else:
                    #
                    # Clear original data
                    #
                    HeaderComments = []
                    HeaderComments.append(Line)
                    StillCommentFalg = True
                    SectionContent += LineContent + DT.END_OF_LINE
                    continue
            else:
                StillCommentFalg = False

            if len(HeaderComments) >= 1:
                LineComment = InfLineCommentObject()
                LineCommentContent = ''
                for Item in HeaderComments:
                    LineCommentContent += Item[0] + DT.END_OF_LINE
                LineComment.SetHeaderComments(LineCommentContent)

            #
            # Find Tail comment.
            #
            if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
                TailComments = LineContent[LineContent.
                                           find(DT.TAB_COMMENT_SPLIT):]
                LineContent = LineContent[:LineContent.find(DT.
                                                            TAB_COMMENT_SPLIT)]
                if LineComment is None:
                    LineComment = InfLineCommentObject()
                LineComment.SetTailComments(TailComments)

            #
            # Find Macro
            #
            Name, Value = MacroParser((LineContent, LineNo), FileName,
                                      DT.MODEL_META_DATA_HEADER,
                                      self.FileLocalMacros)
            if Name is not None:
                self.FileLocalMacros[Name] = Value
                continue

            #
            # Replace with [Defines] section Macro
            #
            LineContent = InfExpandMacro(LineContent,
                                         (FileName, LineContent, LineNo),
                                         self.FileLocalMacros, None, True)

            SectionContent += LineContent + DT.END_OF_LINE

            TokenList = GetSplitValueList(LineContent, DT.TAB_EQUAL_SPLIT, 1)
            if len(TokenList) < 2:
                ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
                           LineInfo=LineInfo)
            _ValueList[0:len(TokenList)] = TokenList
            if not _ValueList[0]:
                ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_NAME,
                           LineInfo=LineInfo)
            if not _ValueList[1]:
                ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_NO_VALUE,
                           LineInfo=LineInfo)

            Name, Value = _ValueList[0], _ValueList[1]

            InfDefMemberObj = InfDefMember(Name, Value)
            if (LineComment is not None):
                InfDefMemberObj.Comments.SetHeaderComments(
                    LineComment.GetHeaderComments())
                InfDefMemberObj.Comments.SetTailComments(
                    LineComment.GetTailComments())

            InfDefMemberObj.CurrentLine.SetFileName(self.FullPath)
            InfDefMemberObj.CurrentLine.SetLineString(LineContent)
            InfDefMemberObj.CurrentLine.SetLineNo(LineNo)

            _ContentList.append(InfDefMemberObj)
            HeaderComments = []
            TailComments = ''

        #
        # Current Define section archs
        #
        if not ArchList:
            ArchList = ['COMMON']

        InfSectionObject.SetAllContent(SectionContent)

        InfSectionObject.SetDefines(_ContentList, Arch=ArchList)
Ejemplo n.º 7
0
    def InfLibraryParser(self, SectionString, InfSectionObject, FileName):
        #
        # For Common INF file
        #
        if not GlobalData.gIS_BINARY_INF:
            #
            # Macro defined in this section
            #
            SectionMacros = {}
            ValueList = []
            LibraryList = []
            LibStillCommentFalg = False
            LibHeaderComments = []
            LibLineComment = None
            #
            # Parse section content
            #
            for Line in SectionString:
                LibLineContent = Line[0]
                LibLineNo = Line[1]

                if LibLineContent.strip() == '':
                    continue

                #
                # Found Header Comments
                #
                if LibLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
                    #
                    # Last line is comments, and this line go on.
                    #
                    if LibStillCommentFalg:
                        LibHeaderComments.append(Line)
                        continue
                    #
                    # First time encounter comment
                    #
                    else:
                        #
                        # Clear original data
                        #
                        LibHeaderComments = []
                        LibHeaderComments.append(Line)
                        LibStillCommentFalg = True
                        continue
                else:
                    LibStillCommentFalg = False

                if len(LibHeaderComments) >= 1:
                    LibLineComment = InfLineCommentObject()
                    LineCommentContent = ''
                    for Item in LibHeaderComments:
                        LineCommentContent += Item[0] + DT.END_OF_LINE
                    LibLineComment.SetHeaderComments(LineCommentContent)

                #
                # Find Tail comment.
                #
                if LibLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
                    LibTailComments = LibLineContent[LibLineContent.find(DT.TAB_COMMENT_SPLIT):]
                    LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]
                    if LibLineComment is None:
                        LibLineComment = InfLineCommentObject()
                    LibLineComment.SetTailComments(LibTailComments)

                #
                # Find Macro
                #
                Name, Value = MacroParser((LibLineContent, LibLineNo),
                                          FileName,
                                          DT.MODEL_EFI_LIBRARY_CLASS,
                                          self.FileLocalMacros)
                if Name is not None:
                    SectionMacros[Name] = Value
                    LibLineComment = None
                    LibHeaderComments = []
                    continue

                TokenList = GetSplitValueList(LibLineContent, DT.TAB_VALUE_SPLIT, 1)
                ValueList[0:len(TokenList)] = TokenList

                #
                # Replace with Local section Macro and [Defines] section Macro.
                #
                ValueList = [InfExpandMacro(Value, (FileName, LibLineContent, LibLineNo),
                                            self.FileLocalMacros, SectionMacros, True)
                                            for Value in ValueList]

                LibraryList.append((ValueList, LibLineComment,
                                    (LibLineContent, LibLineNo, FileName)))
                ValueList = []
                LibLineComment = None
                LibTailComments = ''
                LibHeaderComments = []

                continue

            #
            # Current section archs
            #
            KeyList = []
            for Item in self.LastSectionHeaderContent:
                if (Item[1], Item[2]) not in KeyList:
                    KeyList.append((Item[1], Item[2]))

            if not InfSectionObject.SetLibraryClasses(LibraryList, KeyList=KeyList):
                Logger.Error('InfParser',
                             FORMAT_INVALID,
                             ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR % ("[Library]"),
                             File=FileName,
                             Line=Item[3])
        #
        # For Binary INF
        #
        else:
            self.InfAsBuiltLibraryParser(SectionString, InfSectionObject, FileName)
    def InfBinaryParser(self, SectionString, InfSectionObject, FileName):
        #
        # Macro defined in this section
        #
        SectionMacros = {}
        ValueList = []
        #
        # For UI (UI, SEC_UI, UNI_UI) binaries
        # One and only one UI section can be included
        #
        UiBinaryList = []
        #
        # For Version (VER, SEC_VER, UNI_VER).
        # One and only one VER section on be included
        #
        VerBinaryList = []
        #
        # For other common type binaries
        #
        ComBinaryList = []

        StillCommentFalg = False
        HeaderComments = []
        LineComment = None

        AllSectionContent = ''
        #
        # Parse section content
        #
        for Line in SectionString:
            BinLineContent = Line[0]
            BinLineNo = Line[1]

            if BinLineContent.strip() == '':
                continue

            CurrentLineObj = CurrentLine()
            CurrentLineObj.FileName = FileName
            CurrentLineObj.LineString = BinLineContent
            CurrentLineObj.LineNo = BinLineNo
            #
            # Found Header Comments
            #
            if BinLineContent.strip().startswith(DT.TAB_COMMENT_SPLIT):
                #
                # Last line is comments, and this line go on.
                #
                if StillCommentFalg:
                    HeaderComments.append(Line)
                    AllSectionContent += BinLineContent + DT.END_OF_LINE
                    continue
                #
                # First time encounter comment
                #
                else:
                    #
                    # Clear original data
                    #
                    HeaderComments = []
                    HeaderComments.append(Line)
                    AllSectionContent += BinLineContent + DT.END_OF_LINE
                    StillCommentFalg = True
                    continue
            else:
                StillCommentFalg = False

            if len(HeaderComments) >= 1:
                LineComment = InfLineCommentObject()
                LineCommentContent = ''
                for Item in HeaderComments:
                    LineCommentContent += Item[0] + DT.END_OF_LINE
                LineComment.SetHeaderComments(LineCommentContent)

            #
            # Find Tail comment.
            #
            if BinLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
                TailComments = BinLineContent[BinLineContent.
                                              find(DT.TAB_COMMENT_SPLIT):]
                BinLineContent = BinLineContent[:BinLineContent.
                                                find(DT.TAB_COMMENT_SPLIT)]
                if LineComment == None:
                    LineComment = InfLineCommentObject()
                LineComment.SetTailComments(TailComments)

            #
            # Find Macro
            #
            MacroDef = MacroParser((BinLineContent, BinLineNo), FileName,
                                   DT.MODEL_EFI_BINARY_FILE,
                                   self.FileLocalMacros)
            if MacroDef[0] != None:
                SectionMacros[MacroDef[0]] = MacroDef[1]
                LineComment = None
                HeaderComments = []
                continue

            #
            # Replace with Local section Macro and [Defines] section Macro.
            #
            LineContent = InfExpandMacro(BinLineContent,
                                         (FileName, BinLineContent, BinLineNo),
                                         self.FileLocalMacros, SectionMacros,
                                         True)

            AllSectionContent += LineContent + DT.END_OF_LINE
            TokenList = GetSplitValueList(LineContent, DT.TAB_VALUE_SPLIT, 1)
            ValueList[0:len(TokenList)] = TokenList

            #
            # Should equal to UI/SEC_UI/UNI_UI
            #
            ValueList[0] = ValueList[0].strip()
            if ValueList[0] == DT.BINARY_FILE_TYPE_UNI_UI or \
               ValueList[0] == DT.BINARY_FILE_TYPE_SEC_UI or \
               ValueList[0] == DT.BINARY_FILE_TYPE_UI:
                if len(ValueList) == 2:
                    TokenList = GetSplitValueList(ValueList[1],
                                                  DT.TAB_VALUE_SPLIT, 2)
                    NewValueList = []
                    NewValueList.append(ValueList[0])
                    for Item in TokenList:
                        NewValueList.append(Item)
                    UiBinaryList.append(
                        (NewValueList, LineComment, CurrentLineObj))
            #
            # Should equal to VER/SEC_VER/UNI_VER
            #
            elif ValueList[0] == DT.BINARY_FILE_TYPE_UNI_VER or \
               ValueList[0] == DT.BINARY_FILE_TYPE_SEC_VER or \
               ValueList[0] == DT.BINARY_FILE_TYPE_VER:
                if len(ValueList) == 2:
                    TokenList = GetSplitValueList(ValueList[1],
                                                  DT.TAB_VALUE_SPLIT, 2)
                    NewValueList = []
                    NewValueList.append(ValueList[0])
                    for Item in TokenList:
                        NewValueList.append(Item)
                    VerBinaryList.append(
                        (NewValueList, LineComment, CurrentLineObj))
            else:
                if len(ValueList) == 2:
                    if ValueList[0].strip() == 'SUBTYPE_GUID':
                        TokenList = GetSplitValueList(ValueList[1],
                                                      DT.TAB_VALUE_SPLIT, 5)
                    else:
                        TokenList = GetSplitValueList(ValueList[1],
                                                      DT.TAB_VALUE_SPLIT, 4)

                    NewValueList = []
                    NewValueList.append(ValueList[0])
                    for Item in TokenList:
                        NewValueList.append(Item)
                    ComBinaryList.append(
                        (NewValueList, LineComment, CurrentLineObj))
                elif len(ValueList) == 1:
                    NewValueList = []
                    NewValueList.append(ValueList[0])
                    ComBinaryList.append(
                        (NewValueList, LineComment, CurrentLineObj))

            ValueList = []
            LineComment = None
            TailComments = ''
            HeaderComments = []
            continue

        #
        # Current section archs
        #
        ArchList = []
        for Item in self.LastSectionHeaderContent:
            if Item[1] not in ArchList:
                ArchList.append(Item[1])
                InfSectionObject.SetSupArchList(Item[1])

        InfSectionObject.SetAllContent(AllSectionContent)
        if not InfSectionObject.SetBinary(UiBinaryList, VerBinaryList,
                                          ComBinaryList, ArchList):
            Logger.Error('InfParser',
                         FORMAT_INVALID,
                         ST.ERR_INF_PARSER_MODULE_SECTION_TYPE_ERROR %
                         ("[Binaries]"),
                         File=FileName,
                         Line=Item[3])
Ejemplo n.º 9
0
 def __init__(self):
     self.LibraryName = ''
     self.Types = []
     self.Comments = InfLineCommentObject()
Ejemplo n.º 10
0
 def __init__(self):
     self.CName  = ''
     self.FeatureFlagExp = ''
     self.Comments = InfLineCommentObject()