releasetools: Don't return ZipFile from common.UnzipTemp().
In addition to the unzipping work, common.UnzipTemp() kindly bundles an
open ZipFile object as part of the return value. It doesn't look very
helpful to the callers though. It also looks less obvious that the
caller needs to properly close the handle (missing the close here is
benign though). This CL just removes the ZipFile object out of the
return value, and leaves the work to callers.
Test: `m dist` on both of A/B and non-A/B target.
Test: python -m unittest test_add_img_to_target_files
Test: python -m unittest test_common
Test: python -m unittest test_ota_from_target_files
Test: Check the callers to common.UnzipTemp() in code search.
Change-Id: Id47da3fd42a0e76d6ae8851f05780db319ee48cf
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index bb80556..743c6a0 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -584,8 +584,7 @@
then unzip bar.zip into that_dir/BOOTABLE_IMAGES.
Returns:
- (tempdir, zipobj): tempdir is the name of the temprary directory; zipobj is
- a zipfile.ZipFile (of the main file), open for reading.
+ The name of the temporary directory.
"""
def unzip_to_dir(filename, dirname):
@@ -607,7 +606,7 @@
else:
unzip_to_dir(filename, tmp)
- return tmp, zipfile.ZipFile(filename, "r")
+ return tmp
def GetSparseImage(which, tmpdir, input_zip, allow_shared_blocks):