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>
This commit is contained in:
Gary Lin
2018-06-25 18:31:26 +08:00
committed by Yonghong Zhu
parent 5b0671c1e5
commit 72443dd250
46 changed files with 354 additions and 308 deletions

View File

@ -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.")