Merge "Make common.py python3 compatible"

This commit is contained in:
Treehugger Robot
2021-02-10 18:29:43 +00:00
committed by Gerrit Code Review

View File

@@ -640,7 +640,7 @@ def ExtractFromInputFile(input_file, fn):
"""Extracts the contents of fn from input zipfile or directory into a file.""" """Extracts the contents of fn from input zipfile or directory into a file."""
if isinstance(input_file, zipfile.ZipFile): if isinstance(input_file, zipfile.ZipFile):
tmp_file = MakeTempFile(os.path.basename(fn)) 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)) f.write(input_file.read(fn))
return tmp_file return tmp_file
else: else:
@@ -864,8 +864,8 @@ class PartitionBuildProps(object):
prop_file = GetBootImageBuildProp(boot_img) prop_file = GetBootImageBuildProp(boot_img)
if prop_file is None: if prop_file is None:
return '' return ''
with open(prop_file) as f: with open(prop_file, "r") as f:
return f.read().decode() return f.read()
@staticmethod @staticmethod
def _ReadPartitionPropFile(input_file, name): def _ReadPartitionPropFile(input_file, name):