diff options
Diffstat (limited to 'tools/releasetools/add_img_to_target_files.py')
-rwxr-xr-x | tools/releasetools/add_img_to_target_files.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index e98e4b6..8bbe452 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -30,9 +30,6 @@ if sys.hexversion < 0x02070000: import errno import os -import re -import shutil -import subprocess import tempfile import zipfile @@ -70,10 +67,8 @@ def AddSystem(output_zip, prefix="IMAGES/", recovery_img=None, boot_img=None): block_list = common.MakeTempFile(prefix="system-blocklist-", suffix=".map") imgname = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict, block_list=block_list) - with open(imgname, "rb") as f: - common.ZipWriteStr(output_zip, prefix + "system.img", f.read()) - with open(block_list, "rb") as f: - common.ZipWriteStr(output_zip, prefix + "system.map", f.read()) + common.ZipWrite(output_zip, imgname, prefix + "system.img") + common.ZipWrite(output_zip, block_list, prefix + "system.map") def BuildSystem(input_dir, info_dict, block_list=None): @@ -94,10 +89,8 @@ def AddVendor(output_zip, prefix="IMAGES/"): block_list = common.MakeTempFile(prefix="vendor-blocklist-", suffix=".map") imgname = BuildVendor(OPTIONS.input_tmp, OPTIONS.info_dict, block_list=block_list) - with open(imgname, "rb") as f: - common.ZipWriteStr(output_zip, prefix + "vendor.img", f.read()) - with open(block_list, "rb") as f: - common.ZipWriteStr(output_zip, prefix + "vendor.map", f.read()) + common.ZipWrite(output_zip, imgname, prefix + "vendor.img") + common.ZipWrite(output_zip, block_list, prefix + "vendor.map") def BuildVendor(input_dir, info_dict, block_list=None): @@ -296,7 +289,6 @@ def AddImagesToTargetFiles(filename): output_zip.close() def main(argv): - def option_handler(o, a): if o in ("-a", "--add_missing"): OPTIONS.add_missing = True |