]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/Dictionary.py
Sync EDKII BaseTools to BaseTools project r2065.
[mirror_edk2.git] / BaseTools / Source / Python / Common / Dictionary.py
index e3460e9891d4f995ef22caa1f283bc1200759263..de3556b8929a7c94322478c711d70d240596a27f 100644 (file)
@@ -25,26 +25,26 @@ from DataType import *
 # @retval 1  Open file failed\r
 #\r
 def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):\r
-  try:\r
-      F = open(FileName,'r')\r
-      Keys = []\r
-      for Line in F:\r
-        if Line.startswith(CommentCharacter):\r
-          continue\r
-        LineList = Line.split(KeySplitCharacter,1)\r
-        if len(LineList) >= 2:\r
-          Key = LineList[0].split()\r
-          if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:\r
-            if ValueSplitFlag:\r
-              Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)\r
-            else:\r
-              Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')\r
-            Keys += [Key[0]]\r
-      F.close()\r
-      return 0\r
-  except:\r
-      EdkLogger.info('Open file failed')\r
-      return 1\r
+    try:\r
+        F = open(FileName,'r')\r
+        Keys = []\r
+        for Line in F:\r
+            if Line.startswith(CommentCharacter):\r
+                continue\r
+            LineList = Line.split(KeySplitCharacter,1)\r
+            if len(LineList) >= 2:\r
+                Key = LineList[0].split()\r
+            if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:\r
+                if ValueSplitFlag:\r
+                    Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)\r
+                else:\r
+                    Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')\r
+                Keys += [Key[0]]\r
+        F.close()\r
+        return 0\r
+    except:\r
+        EdkLogger.info('Open file failed')\r
+        return 1\r
 \r
 ## Print the dictionary\r
 #\r
@@ -53,11 +53,11 @@ def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplit
 # @param Dict:  The dictionary to be printed\r
 #\r
 def printDict(Dict):\r
-  if Dict != None:\r
-    KeyList = Dict.keys()\r
-    for Key in KeyList:\r
-      if Dict[Key] != '':\r
-        print Key + ' = ' + str(Dict[Key])\r
+    if Dict != None:\r
+        KeyList = Dict.keys()\r
+        for Key in KeyList:\r
+            if Dict[Key] != '':\r
+                print Key + ' = ' + str(Dict[Key])\r
 \r
 ## Print the dictionary\r
 #\r
@@ -67,9 +67,9 @@ def printDict(Dict):
 # @param key:   The key of the item to be printed\r
 #\r
 def printList(Key, List):\r
-  if type(List) == type([]):\r
-      if len(List) > 0:\r
-        if key.find(TAB_SPLIT) != -1:\r
-          print "\n" + Key\r
-          for Item in List:\r
-            print Item\r
+    if type(List) == type([]):\r
+        if len(List) > 0:\r
+            if Key.find(TAB_SPLIT) != -1:\r
+                print "\n" + Key\r
+                for Item in List:\r
+                    print Item\r