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:
@@ -15,6 +15,7 @@
|
||||
|
||||
## Import Modules
|
||||
#
|
||||
from __future__ import print_function
|
||||
import Common.LongFilePathOs as os
|
||||
import re
|
||||
import os.path as path
|
||||
@@ -688,7 +689,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||
os.makedirs(self.BuildDir)
|
||||
with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:
|
||||
for f in AllWorkSpaceMetaFiles:
|
||||
print >> file, f
|
||||
print(f, file=file)
|
||||
return True
|
||||
|
||||
def _GenPkgLevelHash(self, Pkg):
|
||||
@@ -4362,7 +4363,7 @@ class ModuleAutoGen(AutoGen):
|
||||
os.remove (self.GetTimeStampPath())
|
||||
with open(self.GetTimeStampPath(), 'w+') as file:
|
||||
for f in FileSet:
|
||||
print >> file, f
|
||||
print(f, file=file)
|
||||
|
||||
Module = property(_GetModule)
|
||||
Name = property(_GetBaseName)
|
||||
|
@@ -14,6 +14,7 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from __future__ import print_function
|
||||
import Common.LongFilePathOs as os
|
||||
import re
|
||||
import copy
|
||||
@@ -597,19 +598,19 @@ if __name__ == '__main__':
|
||||
EdkLogger.Initialize()
|
||||
if len(sys.argv) > 1:
|
||||
Br = BuildRule(sys.argv[1])
|
||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1])
|
||||
print
|
||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])
|
||||
print
|
||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])
|
||||
print
|
||||
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
|
||||
print
|
||||
print str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1])
|
||||
print
|
||||
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
|
||||
print
|
||||
print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])
|
||||
print
|
||||
print str(Br[".s", SUP_MODULE_SEC][1])
|
||||
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))
|
||||
print()
|
||||
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))
|
||||
print()
|
||||
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))
|
||||
print()
|
||||
print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
|
||||
print()
|
||||
print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]))
|
||||
print()
|
||||
print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
|
||||
print()
|
||||
print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]))
|
||||
print()
|
||||
print(str(Br[".s", SUP_MODULE_SEC][1]))
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
##
|
||||
# Import Modules
|
||||
#
|
||||
from __future__ import print_function
|
||||
import Common.LongFilePathOs as os, codecs, re
|
||||
import distutils.util
|
||||
import Common.EdkLogger as EdkLogger
|
||||
@@ -684,12 +685,12 @@ class UniFileClassObject(object):
|
||||
# Show the instance itself
|
||||
#
|
||||
def ShowMe(self):
|
||||
print self.LanguageDef
|
||||
print(self.LanguageDef)
|
||||
#print self.OrderedStringList
|
||||
for Item in self.OrderedStringList:
|
||||
print Item
|
||||
print(Item)
|
||||
for Member in self.OrderedStringList[Item]:
|
||||
print str(Member)
|
||||
print(str(Member))
|
||||
|
||||
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||
# script.
|
||||
|
Reference in New Issue
Block a user