]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/MemoryProfileSymbolGen.py
BaseTools: Fix old python2 idioms
[mirror_edk2.git] / BaseTools / Scripts / MemoryProfileSymbolGen.py
index 5709ad4641cb9cb65d8e80cb850bc0fb031dd46e..eaae0283c51d07e67075e897dbce626186b4f9ff 100644 (file)
@@ -14,6 +14,7 @@
 #\r
 ##\r
 \r
+from __future__ import print_function\r
 import os\r
 import re\r
 import sys\r
@@ -58,10 +59,10 @@ class Symbols:
         try:\r
             nmCommand = "nm"\r
             nmLineOption = "-l"\r
-            print "parsing (debug) - " + pdbName\r
+            print("parsing (debug) - " + pdbName)\r
             os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))\r
         except :\r
-            print 'ERROR: nm command not available.  Please verify PATH'\r
+            print('ERROR: nm command not available.  Please verify PATH')\r
             return\r
 \r
         #\r
@@ -111,11 +112,11 @@ class Symbols:
             DIA2DumpCommand = "Dia2Dump.exe"\r
             #DIA2SymbolOption = "-p"\r
             DIA2LinesOption = "-l"\r
-            print "parsing (pdb) - " + pdbName\r
+            print("parsing (pdb) - " + pdbName)\r
             #os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))\r
             os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))\r
         except :\r
-            print 'ERROR: DIA2Dump command not available.  Please verify PATH'\r
+            print('ERROR: DIA2Dump command not available.  Please verify PATH')\r
             return\r
 \r
         #\r
@@ -190,7 +191,7 @@ def processLine(newline):
 \r
     driverPrefixLen = len("Driver - ")\r
     # get driver name\r
-    if cmp(newline[0:driverPrefixLen],"Driver - ") == 0 :\r
+    if cmp(newline[0:driverPrefixLen], "Driver - ") == 0 :\r
         driverlineList = newline.split(" ")\r
         driverName = driverlineList[2]\r
         #print "Checking : ", driverName\r
@@ -213,7 +214,7 @@ def processLine(newline):
         else :\r
             symbolsFile.symbolsTable[driverName].parse_debug_file (driverName, pdbName)\r
 \r
-    elif cmp(newline,"") == 0 :\r
+    elif cmp(newline, "") == 0 :\r
         driverName = ""\r
 \r
     # check entry line\r
@@ -226,7 +227,7 @@ def processLine(newline):
         rvaName = ""\r
         symbolName = ""\r
 \r
-    if cmp(rvaName,"") == 0 :\r
+    if cmp(rvaName, "") == 0 :\r
         return newline\r
     else :\r
         return newline + symbolName\r
@@ -254,16 +255,16 @@ def main():
     try :\r
         file = open(Options.inputfilename)\r
     except Exception:\r
-        print "fail to open " + Options.inputfilename\r
+        print("fail to open " + Options.inputfilename)\r
         return 1\r
     try :\r
         newfile = open(Options.outputfilename, "w")\r
     except Exception:\r
-        print "fail to open " + Options.outputfilename\r
+        print("fail to open " + Options.outputfilename)\r
         return 1\r
 \r
     try:\r
-        while 1:\r
+        while True:\r
             line = file.readline()\r
             if not line:\r
                 break\r