From 08dd311f5dc735c595d39faf2e6f7e2810bb79a9 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 11 Oct 2010 06:26:52 +0000 Subject: Sync EDKII BaseTools to BaseTools project r2065. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10915 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/Common/Dictionary.py | 62 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'BaseTools/Source/Python/Common/Dictionary.py') diff --git a/BaseTools/Source/Python/Common/Dictionary.py b/BaseTools/Source/Python/Common/Dictionary.py index e3460e9891..de3556b892 100644 --- a/BaseTools/Source/Python/Common/Dictionary.py +++ b/BaseTools/Source/Python/Common/Dictionary.py @@ -25,26 +25,26 @@ from DataType import * # @retval 1 Open file failed # def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter): - try: - F = open(FileName,'r') - Keys = [] - for Line in F: - if Line.startswith(CommentCharacter): - continue - LineList = Line.split(KeySplitCharacter,1) - if len(LineList) >= 2: - Key = LineList[0].split() - if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys: - if ValueSplitFlag: - Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter) - else: - Dictionary[Key[0]] = LineList[1].strip().replace('\\','/') - Keys += [Key[0]] - F.close() - return 0 - except: - EdkLogger.info('Open file failed') - return 1 + try: + F = open(FileName,'r') + Keys = [] + for Line in F: + if Line.startswith(CommentCharacter): + continue + LineList = Line.split(KeySplitCharacter,1) + if len(LineList) >= 2: + Key = LineList[0].split() + if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys: + if ValueSplitFlag: + Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter) + else: + Dictionary[Key[0]] = LineList[1].strip().replace('\\','/') + Keys += [Key[0]] + F.close() + return 0 + except: + EdkLogger.info('Open file failed') + return 1 ## Print the dictionary # @@ -53,11 +53,11 @@ def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplit # @param Dict: The dictionary to be printed # def printDict(Dict): - if Dict != None: - KeyList = Dict.keys() - for Key in KeyList: - if Dict[Key] != '': - print Key + ' = ' + str(Dict[Key]) + if Dict != None: + KeyList = Dict.keys() + for Key in KeyList: + if Dict[Key] != '': + print Key + ' = ' + str(Dict[Key]) ## Print the dictionary # @@ -67,9 +67,9 @@ def printDict(Dict): # @param key: The key of the item to be printed # def printList(Key, List): - if type(List) == type([]): - if len(List) > 0: - if key.find(TAB_SPLIT) != -1: - print "\n" + Key - for Item in List: - print Item + if type(List) == type([]): + if len(List) > 0: + if Key.find(TAB_SPLIT) != -1: + print "\n" + Key + for Item in List: + print Item -- cgit v1.2.3