summaryrefslogtreecommitdiff
path: root/scripts/update_payload/applier.py
diff options
context:
space:
mode:
authorAndrew <andrewlassalle@chromium.org>2019-11-23 20:32:35 -0800
committerNicolas Boichat <drinkcat@chromium.org>2019-11-25 13:25:55 +0000
commit8a1de4b6b8e368d7bd2b92f015a83f49764f7b79 (patch)
tree0c1dc401270e8eee6462f923ffb34fc6e1389fd9 /scripts/update_payload/applier.py
parent6955bcc4ffe4cc9d62a88186b9a7e75d095a7897 (diff)
update_payload: Fix array type in applier.py
In python3, the array type 'c' is no longer supported. Type 'c' arrays are replaced by type 'b'(signed char) and 'B'(unsigned char). 'B' is supported by python 2 and python3. Replaced deprecate function 'buffer' by memoryview in python3. BUG=chromium:1027199 TEST=unittest, cros_generate_update_payload, tryjob Change-Id: Id77ba2d1aac0005d31516da4e6ac4617027ca345 Exempt-From-Owner-Approval: -release builders are on fire Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1932226 Tested-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'scripts/update_payload/applier.py')
-rw-r--r--scripts/update_payload/applier.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/update_payload/applier.py b/scripts/update_payload/applier.py
index 7830c002..7eaa07ac 100644
--- a/scripts/update_payload/applier.py
+++ b/scripts/update_payload/applier.py
@@ -52,7 +52,9 @@ import tempfile
from update_payload import common
from update_payload.error import PayloadError
-
+# buffer is not supported in python3, but memoryview has the same functionality
+if sys.version_info.major >= 3:
+ buffer = memoryview # pylint: disable=invalid-name, redefined-builtin
#
# Helper functions.
#
@@ -107,7 +109,7 @@ def _ReadExtents(file_obj, extents, block_size, max_length=-1):
Returns:
A character array containing the concatenated read data.
"""
- data = array.array('c')
+ data = array.array('B')
if max_length < 0:
max_length = sys.maxsize
for ex in extents: