releasetools: Make _GetPropertyFilesString public
ota_from_target_files.py:
Rename PropertyFiles._GetPropertyFilesString to
PropertyFiles.GetPropertyFilesString.
Currently only PropertyFiles.Compute and
PropertyFiles.Finalize gives access to _GetPropertyFilesString.
But Compute force sets reserve_space=True,
and Finalize requires reserved_length.
_GetPropertyFilesString is useful method that can
be used outside releasetools.
One of the usage is in bootable/recovery/updater_sample/.
Test: python -m unittest test_ota_from_target_files
Change-Id: I2cc44ec46a0e68ba071531b003af8cdbfe90e588
Signed-off-by: Zhomart Mukhamejanov <zhomart@google.com>
diff --git a/tools/releasetools/test_ota_from_target_files.py b/tools/releasetools/test_ota_from_target_files.py
index 0eb24b5..213e830 100644
--- a/tools/releasetools/test_ota_from_target_files.py
+++ b/tools/releasetools/test_ota_from_target_files.py
@@ -774,8 +774,7 @@
zip_file = self.construct_zip_package(entries)
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
streaming_metadata = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(streaming_metadata)
@@ -798,8 +797,7 @@
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
raw_length = len(raw_metadata)
@@ -833,8 +831,7 @@
property_files = TestPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
# Should pass the test if verification passes.
@@ -891,8 +888,7 @@
zip_file = self.construct_zip_package(entries)
property_files = StreamingPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
streaming_metadata = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(streaming_metadata)
@@ -915,8 +911,7 @@
property_files = StreamingPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
# First get the raw metadata string (i.e. without padding space).
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
# Should pass the test if verification passes.
@@ -1051,8 +1046,7 @@
zip_file = self.construct_zip_package_withValidPayload(with_metadata=True)
property_files = AbOtaPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files_string = property_files.Finalize(zip_fp, len(raw_metadata))
@@ -1067,8 +1061,7 @@
zip_file = self.construct_zip_package_withValidPayload(with_metadata=True)
property_files = AbOtaPropertyFiles()
with zipfile.ZipFile(zip_file, 'r') as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files.Verify(zip_fp, raw_metadata)
@@ -1101,8 +1094,7 @@
zip_file = self.construct_zip_package(entries)
property_files = NonAbOtaPropertyFiles()
with zipfile.ZipFile(zip_file) as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files_string = property_files.Finalize(zip_fp, len(raw_metadata))
tokens = self._parse_property_files_string(property_files_string)
@@ -1119,8 +1111,7 @@
zip_file = self.construct_zip_package(entries)
property_files = NonAbOtaPropertyFiles()
with zipfile.ZipFile(zip_file) as zip_fp:
- # pylint: disable=protected-access
- raw_metadata = property_files._GetPropertyFilesString(
+ raw_metadata = property_files.GetPropertyFilesString(
zip_fp, reserve_space=False)
property_files.Verify(zip_fp, raw_metadata)