X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FInfClassObject.py;h=7a5ba4eb84cedca5033a862f5eccc9a001a8efa7;hb=7da06eeede10fc8b908327b375bcdf36707ff7b5;hp=e774d80d697b0489f3ce54fda35e0d7487e2003e;hpb=40d841f6a8f84e75409178e19e69b95e01bada0f;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/Common/InfClassObject.py b/BaseTools/Source/Python/Common/InfClassObject.py index e774d80d69..7a5ba4eb84 100644 --- a/BaseTools/Source/Python/Common/InfClassObject.py +++ b/BaseTools/Source/Python/Common/InfClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of INF file # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -14,7 +14,7 @@ ## # Import Modules # -import os +import Common.LongFilePathOs as os import re import EdkLogger from CommonDataClass.CommonClass import LibraryClassClass @@ -29,6 +29,7 @@ import GlobalData from Table.TableInf import TableInf import Database from Parsing import * +from Common.LongFilePathSupport import OpenLongFilePath as open # # Global variable @@ -104,7 +105,7 @@ class InfHeader(ModuleHeaderClass): TAB_INF_DEFINES_VERSION_STRING : "VersionString", TAB_INF_DEFINES_VERSION : "Version", TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver", - TAB_INF_DEFINES_TIANO_R8_FLASHMAP_H : "TianoR8FlashMap_h", + TAB_INF_DEFINES_TIANO_EDK_FLASHMAP_H : "TianoEdkFlashMap_h", TAB_INF_DEFINES_SHADOW : "Shadow", # TAB_INF_DEFINES_LIBRARY_CLASS : "LibraryClass", # TAB_INF_DEFINES_ENTRY_POINT : "ExternImages", @@ -130,21 +131,10 @@ class InfHeader(ModuleHeaderClass): def __contains__(self, key): return key in self._Mapping_ -## InfObject -# -# This class defined basic Inf object which is used by inheriting -# -# @param object: Inherited from object class -# -class InfObject(object): - def __init__(self): - object.__init__() - ## Inf # # This class defined the structure used in Inf object # -# @param InfObject: Inherited from InfObject class # @param Ffilename: Input value for Ffilename of Inf file, default is None # @param IsMergeAllArches: Input value for IsMergeAllArches # True is to merge all arches @@ -162,8 +152,8 @@ class InfObject(object): # @var WorkspaceDir: To store value for WorkspaceDir # @var KeyList: To store value for KeyList, a list for all Keys used in Inf # -class Inf(InfObject): - def __init__(self, Filename = None, IsToDatabase = False, IsToModule = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST): +class Inf(object): + def __init__(self, Filename=None, IsToDatabase=False, IsToModule=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST): self.Identification = Identification() self.Module = ModuleClass() self.UserExtensions = '' @@ -198,7 +188,7 @@ class Inf(InfObject): # # Load Inf file if filename is not None # - if Filename != None: + if Filename is not None: self.LoadInfFile(Filename) # @@ -352,11 +342,11 @@ class Inf(InfObject): # # Remove comment block # - if Line.find(TAB_COMMENT_R8_START) > -1: - ReservedLine = GetSplitValueList(Line, TAB_COMMENT_R8_START, 1)[0] + if Line.find(TAB_COMMENT_EDK_START) > -1: + ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0] IsFindBlockComment = True - if Line.find(TAB_COMMENT_R8_END) > -1: - Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_R8_END, 1)[1] + if Line.find(TAB_COMMENT_EDK_END) > -1: + Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1] ReservedLine = '' IsFindBlockComment = False if IsFindBlockComment: @@ -397,7 +387,7 @@ class Inf(InfObject): CurrentSection = ItemList[0] else: if CurrentSection != ItemList[0]: - EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) + EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) if CurrentSection.upper() not in self.KeyList: RaiseParserError(Line, CurrentSection, Filename, '', LineNo) CurrentSection = TAB_UNKNOWN @@ -408,7 +398,7 @@ class Inf(InfObject): RaiseParserError(Line, CurrentSection, Filename, '', LineNo) else: if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL: - EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) + EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) ArchList.append(ItemList[1].upper()) ThirdList.append(ItemList[2]) @@ -419,7 +409,7 @@ class Inf(InfObject): # if CurrentSection == TAB_UNKNOWN: ErrorMsg = "%s is not in any defined section" % Line - EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError) + EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError) # # Add a section item @@ -465,7 +455,7 @@ class Inf(InfObject): print 'FvExt =', M.Header[Arch].FvExt print 'SourceFv =', M.Header[Arch].SourceFv print 'PcdIsDriver =', M.Header[Arch].PcdIsDriver - print 'TianoR8FlashMap_h =', M.Header[Arch].TianoR8FlashMap_h + print 'TianoEdkFlashMap_h =', M.Header[Arch].TianoEdkFlashMap_h print 'Shadow =', M.Header[Arch].Shadow print 'LibraryClass =', M.Header[Arch].LibraryClass for Item in M.Header[Arch].LibraryClass: @@ -497,13 +487,13 @@ class Inf(InfObject): print Item.Name, Item.Value, Item.SupArchList print '\nPcds =', M.PcdCodes for Item in M.PcdCodes: - print '\tCName=',Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList + print '\tCName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, Item.SupArchList print '\nSources =', M.Sources for Source in M.Sources: print Source.SourceFile, 'Fam=', Source.ToolChainFamily, 'Pcd=', Source.FeatureFlag, 'Tag=', Source.TagName, 'ToolCode=', Source.ToolCode, Source.SupArchList print '\nUserExtensions =', M.UserExtensions for UserExtension in M.UserExtensions: - print UserExtension.UserID, UserExtension.Identifier,UserExtension.Content + print UserExtension.UserID, UserExtension.Identifier, UserExtension.Content print '\nGuids =', M.Guids for Item in M.Guids: print Item.CName, Item.SupArchList, Item.FeatureFlag @@ -613,7 +603,7 @@ class Inf(InfObject): # Get version of INF # if ModuleHeader.InfVersion != "": - # R9 inf + # EdkII inf VersionNumber = ModuleHeader.VersionNumber VersionString = ModuleHeader.VersionString if len(VersionNumber) > 0 and len(VersionString) == 0: @@ -624,12 +614,12 @@ class Inf(InfObject): EdkLogger.warn(2001, 'INF file %s defines both VERSION_NUMBER and VERSION_STRING, using VERSION_STRING' % self.Identification.FileFullPath) ModuleHeader.Version = VersionString else: - # R8 inf + # Edk inf ModuleHeader.InfVersion = "0x00010000" if ModuleHeader.ComponentType in gComponentType2ModuleType: ModuleHeader.ModuleType = gComponentType2ModuleType[ModuleHeader.ComponentType] elif ModuleHeader.ComponentType != '': - EdkLogger.error("Parser", PARSER_ERROR, "Unsupported R8 component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError = EdkLogger.IsRaiseError) + EdkLogger.error("Parser", PARSER_ERROR, "Unsupported Edk component type [%s]" % ModuleHeader.ComponentType, ExtraData=File, RaiseError=EdkLogger.IsRaiseError) self.Module.Header[Arch] = ModuleHeader @@ -841,7 +831,7 @@ class Inf(InfObject): Nmake.SupArchList = Nmakes[Key] self.Module.Nmake.append(Nmake) - # convert R8 format to R9 format + # convert Edk format to EdkII format if Nmake.Name == "IMAGE_ENTRY_POINT": Image = ModuleExternImageClass() Image.ModuleEntryPoint = Nmake.Value