summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-06-25 18:31:26 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-06-27 16:33:21 +0800
commit72443dd25014a8b6209895640af36dec33da51e0 (patch)
treece91675cb7bfadbd4c8686b19d3d816fb968f612 /BaseTools/Source/Python/Eot/CodeFragmentCollector.py
parent5b0671c1e514e534c6d5be9604da33bfc2cd0a24 (diff)
downloadedk2-72443dd25014a8b6209895640af36dec33da51e0.tar.gz
BaseTools: Refactor python print statements
Refactor print statements to be compatible with python 3. Based on "futurize -f libfuturize.fixes.fix_print_with_import" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Eot/CodeFragmentCollector.py')
-rw-r--r--BaseTools/Source/Python/Eot/CodeFragmentCollector.py61
1 files changed, 31 insertions, 30 deletions
diff --git a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
index 87f179206d..1e30e2ce62 100644
--- a/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
+++ b/BaseTools/Source/Python/Eot/CodeFragmentCollector.py
@@ -15,6 +15,7 @@
##
# Import Modules
#
+from __future__ import print_function
import re
import Common.LongFilePathOs as os
import sys
@@ -379,49 +380,49 @@ class CodeFragmentCollector:
#
def PrintFragments(self):
- print '################# ' + self.FileName + '#####################'
+ print('################# ' + self.FileName + '#####################')
- print '/****************************************/'
- print '/*************** ASSIGNMENTS ***************/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/*************** ASSIGNMENTS ***************/')
+ print('/****************************************/')
for asign in FileProfile.AssignmentExpressionList:
- print str(asign.StartPos) + asign.Name + asign.Operator + asign.Value
+ print(str(asign.StartPos) + asign.Name + asign.Operator + asign.Value)
- print '/****************************************/'
- print '/********* PREPROCESS DIRECTIVES ********/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/********* PREPROCESS DIRECTIVES ********/')
+ print('/****************************************/')
for pp in FileProfile.PPDirectiveList:
- print str(pp.StartPos) + pp.Content
+ print(str(pp.StartPos) + pp.Content)
- print '/****************************************/'
- print '/********* VARIABLE DECLARATIONS ********/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/********* VARIABLE DECLARATIONS ********/')
+ print('/****************************************/')
for var in FileProfile.VariableDeclarationList:
- print str(var.StartPos) + var.Modifier + ' '+ var.Declarator
+ print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)
- print '/****************************************/'
- print '/********* FUNCTION DEFINITIONS *********/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/********* FUNCTION DEFINITIONS *********/')
+ print('/****************************************/')
for func in FileProfile.FunctionDefinitionList:
- print str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos)
+ print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))
- print '/****************************************/'
- print '/************ ENUMERATIONS **************/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/************ ENUMERATIONS **************/')
+ print('/****************************************/')
for enum in FileProfile.EnumerationDefinitionList:
- print str(enum.StartPos) + enum.Content
+ print(str(enum.StartPos) + enum.Content)
- print '/****************************************/'
- print '/*********** STRUCTS/UNIONS *************/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/*********** STRUCTS/UNIONS *************/')
+ print('/****************************************/')
for su in FileProfile.StructUnionDefinitionList:
- print str(su.StartPos) + su.Content
+ print(str(su.StartPos) + su.Content)
- print '/****************************************/'
- print '/************** TYPEDEFS ****************/'
- print '/****************************************/'
+ print('/****************************************/')
+ print('/************** TYPEDEFS ****************/')
+ print('/****************************************/')
for typedef in FileProfile.TypedefDefinitionList:
- print str(typedef.StartPos) + typedef.ToType
+ print(str(typedef.StartPos) + typedef.ToType)
##
#
@@ -430,4 +431,4 @@ class CodeFragmentCollector:
#
if __name__ == "__main__":
- print "For Test."
+ print("For Test.")