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/update_payload/histogram.py b/scripts/update_payload/histogram.py
index 1ac2ab5..bad2dc3 100644
--- a/scripts/update_payload/histogram.py
+++ b/scripts/update_payload/histogram.py
@@ -16,6 +16,9 @@
"""Histogram generation tools."""
+from __future__ import absolute_import
+from __future__ import division
+
from collections import defaultdict
from update_payload import format_utils
@@ -110,7 +113,7 @@
hist_bar = '|'
for key, count in self.data:
if self.total:
- bar_len = count * self.scale / self.total
+ bar_len = count * self.scale // self.total
hist_bar = '|%s|' % ('#' * bar_len).ljust(self.scale)
line = '%s %s %s' % (