diff options
author | Marty E. Plummer <hanetzer@startmail.com> | 2019-05-10 00:43:56 -0500 |
---|---|---|
committer | RAJA DAS <rajadas2@in.ibm.com> | 2020-01-15 23:42:58 -0600 |
commit | e0e6c72e94c754b76b1cdd4cbc44a15762e04dee (patch) | |
tree | ceec48183120c4b20de16efd4ddcc5488f5ec203 /src/boot | |
parent | 54f3205f2ce678cf8d377f4d3d5c23b3bce33096 (diff) | |
download | talos-sbe-e0e6c72e94c754b76b1cdd4cbc44a15762e04dee.tar.gz talos-sbe-e0e6c72e94c754b76b1cdd4cbc44a15762e04dee.zip |
treewide: use print function instead of statement
This enables better compat between python2.7 and python3.x
Without this change, building with python3.x (python3.5 tested) as
/usr/bin/python will result in the following error:
File: "sbe/src/build/security/securityRegListGen.py", line 64
-v, --verbose enable verbose traces"
^
SyntaxError: Missing parentheses in call to 'print'
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Change-Id: Id617f54096fca5cc5fcd829767595a85350e343d
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/89618
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Diffstat (limited to 'src/boot')
-rwxr-xr-x | src/boot/sbeCompression.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/boot/sbeCompression.py b/src/boot/sbeCompression.py index 61ce0057..379ddf10 100755 --- a/src/boot/sbeCompression.py +++ b/src/boot/sbeCompression.py @@ -23,6 +23,7 @@ # permissions and limitations under the License. # # IBM_PROLOG_END_TAG +from __future__ import print_function import os import subprocess import re @@ -40,17 +41,17 @@ def compress(inputFile, compressedFile): try: f = open(inputFile, "rb") except IOError as e : - print "I/O error File for File to be compressed." + print("I/O error File for File to be compressed.") sys.exit(1) try: fW = open(compressedFile, "wb") except IOError as e : - print "I/O error File for compressed file." + print("I/O error File for compressed file.") sys.exit(1) if os.stat(inputFile).st_size < 4 : - print "File is less than four bytes." + print("File is less than four bytes.") sys.exit(1) instDict = dict() @@ -132,13 +133,13 @@ def compress(inputFile, compressedFile): fW.close() def usage(): - print "usage: sbeCompression.py [-h] [-l <path>] [-i <image>]" - print "SBE Compression Parser" - print "Arguments:" - print "-h, --help\t\tshow this help message and exit" - print "-l, --imageLoc\t\tSeeprom Binary Location" - print "-i, --image\t\tSeeprom Binary" - print "-p, --p9_xip_tool\t\tp9_xip_tool path" + print("usage: sbeCompression.py [-h] [-l <path>] [-i <image>]") + print("SBE Compression Parser") + print("Arguments:") + print("-h, --help\t\tshow this help message and exit") + print("-l, --imageLoc\t\tSeeprom Binary Location") + print("-i, --image\t\tSeeprom Binary") + print("-p, --p9_xip_tool\t\tp9_xip_tool path") return 1 def main( argv ): @@ -146,7 +147,7 @@ def main( argv ): try: opts, args = getopt.getopt(argv[1:], "l:i:p:h", ['imageLoc=', 'image=', 'p9_xip_tool=', 'help']) except getopt.GetoptError as err: - print str(err) + print(str(err)) usage() exit(1) @@ -169,14 +170,14 @@ def main( argv ): cmd1 = "cp " + imagePath + "/" + image + " " + imagePath + "/" + image + ".orig" rc = os.system(cmd1) if rc: - print "Unable to make copy of seeprom binary" + print("Unable to make copy of seeprom binary") sys.exit(1) #Extract base from SEEPROM binary. cmd2 = p9_xip_tool + " " + imagePath + "/" + image + " extract .base " + imagePath + "/" + image + ".base" rc = os.system(cmd2) if rc: - print "Unable to extract the base from seeprom binary" + print("Unable to extract the base from seeprom binary") sys.exit(1) #Compress the base section @@ -186,14 +187,14 @@ def main( argv ): cmd3 = p9_xip_tool + " " + imagePath + "/" + image + " delete .base" rc = os.system(cmd3) if rc: - print "Unable to delete base section from seeprom binary" + print("Unable to delete base section from seeprom binary") sys.exit(1) #Append the base section from SEEPEOM binary. cmd4 = p9_xip_tool + " " + imagePath + "/" + image + " append .base " + imagePath + "/" + image + ".base.compressed" rc = os.system(cmd4) if rc: - print "Unable to append the base section" + print("Unable to append the base section") sys.exit(1) if __name__ == "__main__": |