summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/img_from_target_files.py
diff options
context:
space:
mode:
authorAnthony King <anthonydking@slimroms.net>2015-11-03 00:23:11 +0000
committerTom Powell <tpowell@cyngn.com>2016-01-04 11:09:01 -0800
commitc713d764c53e439352e79076eeecdbed9b2ccd6c (patch)
treeec2c6e1f7d912a03442405d8fa28cf23de9d889b /tools/releasetools/img_from_target_files.py
parent12b55e8654520aac7cb466e7c149a11a48cc3b0e (diff)
downloadbuild-c713d764c53e439352e79076eeecdbed9b2ccd6c.zip
build-c713d764c53e439352e79076eeecdbed9b2ccd6c.tar.gz
build-c713d764c53e439352e79076eeecdbed9b2ccd6c.tar.bz2
py3: update all the things
Change-Id: I5e11b46b7c2f7f8760d6c0e713ca99c1e88b7cd3
Diffstat (limited to 'tools/releasetools/img_from_target_files.py')
-rwxr-xr-xtools/releasetools/img_from_target_files.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 09fc64d..d486a7a 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -26,10 +26,12 @@ Usage: img_from_target_files [flags] input_target_files output_image_zip
"""
+from __future__ import print_function
+
import sys
if sys.hexversion < 0x02070000:
- print >> sys.stderr, "Python 2.7 or newer is required."
+ print("Python 2.7 or newer is required.", file=sys.stderr)
sys.exit(1)
import errno
@@ -61,7 +63,7 @@ def AddRadio(output_zip):
# If a filesmap file exists, create a script to flash the radio images based on it
filesmap = os.path.join(OPTIONS.input_tmp, "RADIO/filesmap")
if os.path.isfile(filesmap):
- print "creating flash-radio.sh..."
+ print("creating flash-radio.sh...")
filesmap_data = open(filesmap, "r")
filesmap_regex = re.compile(r'^(\S+)\s\S+\/by-name\/(\S+).*')
tmp_flash_radio = tempfile.NamedTemporaryFile()
@@ -74,7 +76,7 @@ def AddRadio(output_zip):
if os.path.getsize(tmp_flash_radio.name) > 0:
output_zip.write(tmp_flash_radio.name, "flash-radio.sh")
else:
- print "flash-radio.sh is empty, skipping..."
+ print("flash-radio.sh is empty, skipping...")
tmp_flash_radio.close()
def main(argv):
@@ -146,7 +148,7 @@ def main(argv):
recovery_image.AddToZip(output_zip)
def banner(s):
- print "\n\n++++ " + s + " ++++\n\n"
+ print("\n\n++++ " + s + " ++++\n\n")
if not bootable_only:
banner("AddSystem")
@@ -165,11 +167,11 @@ def main(argv):
add_img_to_target_files.AddCache(output_zip, prefix="")
finally:
- print "cleaning up..."
+ print("cleaning up...")
common.ZipClose(output_zip)
shutil.rmtree(OPTIONS.input_tmp)
- print "done."
+ print("done.")
if __name__ == '__main__':
@@ -177,7 +179,7 @@ if __name__ == '__main__':
common.CloseInheritedPipes()
main(sys.argv[1:])
except common.ExternalError as e:
- print
- print " ERROR: %s" % (e,)
- print
+ print()
+ print(" ERROR: %s" % e)
+ print()
sys.exit(1)