]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/SmiHandlerProfileSymbolGen.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / SmiHandlerProfileSymbolGen.py
index f03278b64f8f74f85e1c169f9a1fcbc52c29a584..1e2e7fd1049b650c6e6325f978ff2182b4f9c9db 100644 (file)
@@ -4,16 +4,11 @@
 # This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.\r
 #\r
 # Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials are licensed and made available under\r
-# the terms and conditions of the BSD License that accompanies this distribution.\r
-# The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 ##\r
 \r
+from __future__ import print_function\r
 import os\r
 import re\r
 import sys\r
@@ -61,10 +56,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
@@ -103,11 +98,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
@@ -204,7 +199,7 @@ def genGuidString(guidreffile):
         if len(guidLineList) == 2:\r
             guid = guidLineList[0]\r
             guidName = guidLineList[1]\r
-            if guid not in dictGuid.keys() :\r
+            if guid not in dictGuid :\r
                 dictGuid[guid] = guidName\r
 \r
 def createSym(symbolName):\r
@@ -235,14 +230,14 @@ def main():
     try :\r
         DOMTree = xml.dom.minidom.parse(Options.inputfilename)\r
     except Exception:\r
-        print "fail to open input " + Options.inputfilename\r
+        print("fail to open input " + Options.inputfilename)\r
         return 1\r
 \r
     if Options.guidreffilename is not None:\r
         try :\r
             guidreffile = open(Options.guidreffilename)\r
         except Exception:\r
-            print "fail to open guidref" + Options.guidreffilename\r
+            print("fail to open guidref" + Options.guidreffilename)\r
             return 1\r
         genGuidString(guidreffile)\r
         guidreffile.close()\r
@@ -256,7 +251,7 @@ def main():
         for smiEntry in SmiEntry:\r
             if smiEntry.hasAttribute("HandlerType"):\r
                 guidValue = smiEntry.getAttribute("HandlerType")\r
-                if guidValue in dictGuid.keys() :\r
+                if guidValue in dictGuid:\r
                     smiEntry.setAttribute("HandlerType", dictGuid[guidValue])\r
             SmiHandler = smiEntry.getElementsByTagName("SmiHandler")\r
             for smiHandler in SmiHandler:\r
@@ -277,7 +272,7 @@ def main():
 \r
                     Handler = smiHandler.getElementsByTagName("Handler")\r
                     RVA = Handler[0].getElementsByTagName("RVA")\r
-                    print "    Handler RVA: %s" % RVA[0].childNodes[0].data\r
+                    print("    Handler RVA: %s" % RVA[0].childNodes[0].data)\r
 \r
                     if (len(RVA)) >= 1:\r
                         rvaName = RVA[0].childNodes[0].data\r
@@ -289,7 +284,7 @@ def main():
 \r
                     Caller = smiHandler.getElementsByTagName("Caller")\r
                     RVA = Caller[0].getElementsByTagName("RVA")\r
-                    print "    Caller RVA: %s" % RVA[0].childNodes[0].data\r
+                    print("    Caller RVA: %s" % RVA[0].childNodes[0].data)\r
 \r
                     if (len(RVA)) >= 1:\r
                         rvaName = RVA[0].childNodes[0].data\r
@@ -302,7 +297,7 @@ def main():
     try :\r
         newfile = open(Options.outputfilename, "w")\r
     except Exception:\r
-        print "fail to open output" + Options.outputfilename\r
+        print("fail to open output" + Options.outputfilename)\r
         return 1\r
 \r
     newfile.write(DOMTree.toprettyxml(indent = "\t", newl = "\n", encoding = "utf-8"))\r