Make common.py python3 compatible
Test: th
Change-Id: Ibe4db0a367b7b8df5eeb7f2a6d0816e8e18bf342
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 26c4ae8..acd978f 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -663,7 +663,7 @@
"""Extracts the contents of fn from input zipfile or directory into a file."""
if isinstance(input_file, zipfile.ZipFile):
tmp_file = MakeTempFile(os.path.basename(fn))
- with open(tmp_file, 'w') as f:
+ with open(tmp_file, 'wb') as f:
f.write(input_file.read(fn))
return tmp_file
else:
@@ -887,8 +887,8 @@
prop_file = GetBootImageBuildProp(boot_img)
if prop_file is None:
return ''
- with open(prop_file) as f:
- return f.read().decode()
+ with open(prop_file, "r") as f:
+ return f.read()
@staticmethod
def _ReadPartitionPropFile(input_file, name):