X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FEot%2FParser.py;h=e01a9770befbc7d3340d79c41e153b67571184ae;hp=9ef71a958769dc17050bb2b7c8faac8ff016772f;hb=64429fbd61d445b892a78f4e55b0b83c184790bd;hpb=40d841f6a8f84e75409178e19e69b95e01bada0f diff --git a/BaseTools/Source/Python/Eot/Parser.py b/BaseTools/Source/Python/Eot/Parser.py index 9ef71a9587..e01a9770be 100644 --- a/BaseTools/Source/Python/Eot/Parser.py +++ b/BaseTools/Source/Python/Eot/Parser.py @@ -2,7 +2,7 @@ # This file is used to define common parsing related functions used in parsing # Inf/Dsc/Makefile process # -# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 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 @@ -15,13 +15,15 @@ ## # Import Modules # -import os, re +from __future__ import absolute_import +import Common.LongFilePathOs as os, re import Common.EdkLogger as EdkLogger from Common.DataType import * from CommonDataClass.DataClass import * -from Common.String import CleanString, GetSplitValueList, ReplaceMacro -import EotGlobalData -from Common.Misc import sdict +from Common.StringUtils import CleanString, GetSplitValueList, ReplaceMacro +from . import EotGlobalData +from Common.StringUtils import GetSplitList +from Common.LongFilePathSupport import OpenLongFilePath as open ## PreProcess() method # @@ -49,11 +51,11 @@ def PreProcess(Filename, MergeMultipleLines = True, LineNo = -1): for Line in open(Filename, 'r'): Line = Line.strip() # 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: @@ -621,7 +623,7 @@ def SearchProtocols(SqlCommand, Table, SourceFileID, SourceFileFullPath, ItemMod # @param ItemMode: Mode of item # def SearchFunctionCalling(Table, SourceFileID, SourceFileFullPath, ItemType, ItemMode): - LibraryList = sdict() + LibraryList = {} Db = EotGlobalData.gDb.TblReport Parameters, ItemName, GuidName, GuidMacro, GuidValue, BelongsToFunction = [], '', '', '', '', '' if ItemType == 'Protocol' and ItemMode == 'Produced': @@ -729,7 +731,7 @@ def GetParameter(Parameter, Index = 1): # @return: The name of parameter # def GetParameterName(Parameter): - if type(Parameter) == type('') and Parameter.startswith('&'): + if isinstance(Parameter, type('')) and Parameter.startswith('&'): return Parameter[1:].replace('{', '').replace('}', '').replace('\r', '').replace('\n', '').strip() else: return Parameter.strip()