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

@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
from __future__ import print_function
import os
from message import *
@ -446,4 +447,4 @@ if __name__== '__main__':
p.AddPage(Page('PCD', 'pcds'))
df.Generate()
print df
print(df)

View File

@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
from __future__ import print_function
import array
import uuid
import re
@ -250,12 +251,12 @@ class EfiFirmwareVolumeHeader(BinaryItem):
return list2int(self._arr.tolist()[48:50])
def Dump(self):
print 'Signature: %s' % self.GetSigunature()
print 'Attribute: 0x%X' % self.GetAttribute()
print 'Header Length: 0x%X' % self.GetHeaderLength()
print 'File system Guid: ', self.GetFileSystemGuid()
print 'Revision: 0x%X' % self.GetRevision()
print 'FvLength: 0x%X' % self.GetFvLength()
print('Signature: %s' % self.GetSigunature())
print('Attribute: 0x%X' % self.GetAttribute())
print('Header Length: 0x%X' % self.GetHeaderLength())
print('File system Guid: ', self.GetFileSystemGuid())
print('Revision: 0x%X' % self.GetRevision())
print('FvLength: 0x%X' % self.GetFvLength())
def GetFileSystemGuid(self):
list = self._arr.tolist()
@ -348,7 +349,7 @@ class EfiFfs(object):
line.append('0x%X' % int(item))
count += 1
else:
print ' '.join(line)
print(' '.join(line))
count = 0
line = []
line.append('0x%X' % int(item))
@ -445,11 +446,11 @@ class EfiFfsHeader(BinaryItem):
return 'Unknown Ffs State'
def Dump(self):
print "FFS name: ", self.GetNameGuid()
print "FFS type: ", self.GetType()
print "FFS attr: 0x%X" % self.GetAttributes()
print "FFS size: 0x%X" % self.GetFfsSize()
print "FFS state: 0x%X" % self.GetState()
print("FFS name: ", self.GetNameGuid())
print("FFS type: ", self.GetType())
print("FFS attr: 0x%X" % self.GetAttributes())
print("FFS size: 0x%X" % self.GetFfsSize())
print("FFS state: 0x%X" % self.GetState())
def GetRawData(self):
return self._arr.tolist()
@ -528,8 +529,8 @@ class EfiSectionHeader(BinaryItem):
return self.section_type_map[type]
def Dump(self):
print 'size = 0x%X' % self.GetSectionSize()
print 'type = 0x%X' % self.GetType()
print('size = 0x%X' % self.GetSectionSize())
print('type = 0x%X' % self.GetType())