]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
BaseTools: Refactor python print statements
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / CodeFragmentCollector.py
index ffa51de7c1bfd76c4f085eb882a1bd8bee32a1f7..2efae2c7c1de9c0dfe92ba9fa9cfcc14cd385acc 100644 (file)
@@ -16,6 +16,7 @@
 # Import Modules\r
 #\r
 \r
+from __future__ import print_function\r
 import re\r
 import Common.LongFilePathOs as os\r
 import sys\r
@@ -533,58 +534,58 @@ class CodeFragmentCollector:
         \r
     def PrintFragments(self):\r
         \r
-        print '################# ' + self.FileName + '#####################'\r
+        print('################# ' + self.FileName + '#####################')\r
         \r
-        print '/****************************************/'\r
-        print '/*************** COMMENTS ***************/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/*************** COMMENTS ***************/')\r
+        print('/****************************************/')\r
         for comment in FileProfile.CommentList:\r
-            print str(comment.StartPos) + comment.Content\r
+            print(str(comment.StartPos) + comment.Content)\r
         \r
-        print '/****************************************/'\r
-        print '/********* PREPROCESS DIRECTIVES ********/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/********* PREPROCESS DIRECTIVES ********/')\r
+        print('/****************************************/')\r
         for pp in FileProfile.PPDirectiveList:\r
-            print str(pp.StartPos) + pp.Content\r
+            print(str(pp.StartPos) + pp.Content)\r
         \r
-        print '/****************************************/'\r
-        print '/********* VARIABLE DECLARATIONS ********/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/********* VARIABLE DECLARATIONS ********/')\r
+        print('/****************************************/')\r
         for var in FileProfile.VariableDeclarationList:\r
-            print str(var.StartPos) + var.Modifier + ' '+ var.Declarator\r
+            print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)\r
             \r
-        print '/****************************************/'\r
-        print '/********* FUNCTION DEFINITIONS *********/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/********* FUNCTION DEFINITIONS *********/')\r
+        print('/****************************************/')\r
         for func in FileProfile.FunctionDefinitionList:\r
-            print str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos)\r
+            print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))\r
             \r
-        print '/****************************************/'\r
-        print '/************ ENUMERATIONS **************/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/************ ENUMERATIONS **************/')\r
+        print('/****************************************/')\r
         for enum in FileProfile.EnumerationDefinitionList:\r
-            print str(enum.StartPos) + enum.Content\r
+            print(str(enum.StartPos) + enum.Content)\r
         \r
-        print '/****************************************/'\r
-        print '/*********** STRUCTS/UNIONS *************/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/*********** STRUCTS/UNIONS *************/')\r
+        print('/****************************************/')\r
         for su in FileProfile.StructUnionDefinitionList:\r
-            print str(su.StartPos) + su.Content\r
+            print(str(su.StartPos) + su.Content)\r
             \r
-        print '/****************************************/'\r
-        print '/********* PREDICATE EXPRESSIONS ********/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/********* PREDICATE EXPRESSIONS ********/')\r
+        print('/****************************************/')\r
         for predexp in FileProfile.PredicateExpressionList:\r
-            print str(predexp.StartPos) + predexp.Content\r
+            print(str(predexp.StartPos) + predexp.Content)\r
         \r
-        print '/****************************************/'    \r
-        print '/************** TYPEDEFS ****************/'\r
-        print '/****************************************/'\r
+        print('/****************************************/')\r
+        print('/************** TYPEDEFS ****************/')\r
+        print('/****************************************/')\r
         for typedef in FileProfile.TypedefDefinitionList:\r
-            print str(typedef.StartPos) + typedef.ToType\r
+            print(str(typedef.StartPos) + typedef.ToType)\r
         \r
 if __name__ == "__main__":\r
     \r
     collector = CodeFragmentCollector(sys.argv[1])\r
     collector.PreprocessFile()\r
-    print "For Test."\r
+    print("For Test.")\r