summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorYilin Yang <kerker@google.com>2020-09-22 15:02:20 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-25 09:48:24 +0000
commitec0439e97a72b35fe701b157bba63b1e40a7eafe (patch)
tree9e2b3627915efa9391df9041510509446a18a421 /extra
parent9e5e0e5dba9ed3b641f3595526b2d1488b00a4b6 (diff)
downloadchrome-ec-ec0439e97a72b35fe701b157bba63b1e40a7eafe.tar.gz
usb_power: Migrate convert_power_log_board.py to python2/3 compatible
BUG=chromium:1031705 BRANCH=master TEST=`python3 convert_power_log_board.py board/kevin/kevin.board` can produce the same output as before TEST=`python2 convert_power_log_board.py board/kevin/kevin.board` can produce the same output as before Signed-off-by: kerker <kerker@chromium.org> Change-Id: I681c4ff2d7c98ad25f516982a5bc4ebb1b8caee4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2422064 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/usb_power/convert_power_log_board.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/extra/usb_power/convert_power_log_board.py b/extra/usb_power/convert_power_log_board.py
index b970d86cd7..da0750ea86 100644
--- a/extra/usb_power/convert_power_log_board.py
+++ b/extra/usb_power/convert_power_log_board.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -7,6 +7,9 @@
Program to convert sweetberry config to servod config template.
"""
+# Note: This is a py2/3 compatible file.
+
+from __future__ import print_function
import json
import os
import sys
@@ -60,8 +63,8 @@ def write_to_file(file, sweetberry, inas):
def main(argv):
if len(argv) != 2:
- print "usage:"
- print " %s input.board" % argv[0]
+ print("usage:")
+ print(" %s input.board" % argv[0])
return
inputf = argv[1]
@@ -72,12 +75,12 @@ def main(argv):
sweetberry = set(rec['sweetberry'] for rec in inas)
if len(sweetberry) == 2:
- print "Converting %s to %s and %s" % (inputf, basename + '_a.py',
- basename + '_b.py')
+ print("Converting %s to %s and %s" % (inputf, basename + '_a.py',
+ basename + '_b.py'))
write_to_file(basename + '_a.py', 'A', inas)
write_to_file(basename + '_b.py', 'B', inas)
else:
- print "Converting %s to %s" % (inputf, basename + '.py')
+ print("Converting %s to %s" % (inputf, basename + '.py'))
write_to_file(basename + '.py', sweetberry.pop(), inas)