update_payload: Port scripts to python3
Update the update_payload scripts to be compatible with
python2 and python3. Python2 compatibility is needed since
the repo is shared with Android.
BUG=chromium:1011631
TEST=Executed aosp/system/update_engine/scripts/run_unittests and
cros_generate_update_payload
Cq-Depend: chromium:1904837, chromium:1911499
Change-Id: Ie450b80b5f7550051b38d320173ccc0c915f65e7
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1904310
Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
Tested-by: Andrew Lassalle <andrewlassalle@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Auto-Submit: Andrew Lassalle <andrewlassalle@chromium.org>
diff --git a/scripts/paycheck.py b/scripts/paycheck.py
index 875b00f..3587750 100755
--- a/scripts/paycheck.py
+++ b/scripts/paycheck.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
#
# Copyright (C) 2013 The Android Open Source Project
#
@@ -17,6 +17,7 @@
"""Command-line tool for checking and applying Chrome OS update payloads."""
+from __future__ import absolute_import
from __future__ import print_function
# pylint: disable=import-error
@@ -26,13 +27,14 @@
import sys
import tempfile
-from update_payload import common
+from six.moves import zip
from update_payload import error
+
lib_dir = os.path.join(os.path.dirname(__file__), 'lib')
if os.path.exists(lib_dir) and os.path.isdir(lib_dir):
sys.path.insert(1, lib_dir)
-import update_payload
+import update_payload # pylint: disable=wrong-import-position
_TYPE_FULL = 'full'
@@ -287,7 +289,7 @@
# files are created as temp files and will be deleted upon close().
for handle in file_handles:
handle.close()
- except error.PayloadError, e:
+ except error.PayloadError as e:
sys.stderr.write('Error: %s\n' % e)
return 1