aboutsummaryrefslogtreecommitdiff
path: root/crosperf/compare_machines.py
diff options
context:
space:
mode:
authorYunlian Jiang <yunlian@google.com>2015-12-09 10:29:44 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-09 22:32:56 +0000
commite55d35ee104a41e5f7ae96f4e326f33f6beaf412 (patch)
tree762feeefa137cad92fc044dbe0ee011dd11c64d0 /crosperf/compare_machines.py
parent0d1a9f32c928e21a72547f3d334d631c5861f027 (diff)
downloadtoolchain-utils-e55d35ee104a41e5f7ae96f4e326f33f6beaf412.tar.gz
crosperf: fix two file for lint warning.
BUG=chromium:567921 TEST=the warning is gone. Change-Id: Id7c0b04728342992ddc3909fa2c94e98b9e70fba Reviewed-on: https://chrome-internal-review.googlesource.com/241485 Commit-Ready: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf/compare_machines.py')
-rw-r--r--crosperf/compare_machines.py84
1 files changed, 42 insertions, 42 deletions
diff --git a/crosperf/compare_machines.py b/crosperf/compare_machines.py
index a6be0c6f..f04fa2ed 100644
--- a/crosperf/compare_machines.py
+++ b/crosperf/compare_machines.py
@@ -1,64 +1,64 @@
-#!/usr/bin/python
-
# Copyright 2014 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.
+"""Module to compare two machines."""
+
+from __future__ import print_function
+
import os.path
import sys
import argparse
from machine_manager import CrosMachine
-def PrintUsage (msg):
- print msg
- print "Usage: "
- print ("\n compare_machines.py --chromeos_root=/path/to/chroot/ "
- "machine1 machine2 ...")
+def PrintUsage(msg):
+ print(msg)
+ print("Usage: ")
+ print("\n compare_machines.py --chromeos_root=/path/to/chroot/ "
+ "machine1 machine2 ...")
-def Main (argv):
+def Main(argv):
- parser = argparse.ArgumentParser()
- parser.add_argument("--chromeos_root", default="/path/to/chromeos",
- dest="chromeos_root",
- help="ChromeOS root checkout directory")
- parser.add_argument("remotes", nargs=argparse.REMAINDER)
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--chromeos_root", default="/path/to/chromeos",
+ dest="chromeos_root",
+ help="ChromeOS root checkout directory")
+ parser.add_argument("remotes", nargs=argparse.REMAINDER)
- options = parser.parse_args(argv)
+ options = parser.parse_args(argv)
- false_arg = True
- machine_list = options.remotes
- if len(machine_list) < 2:
- PrintUsage("ERROR: Must specify at least two machines.")
- return 1
- elif not os.path.exists(options.chromeos_root):
- PrintUsage("Error: chromeos_root does not exist %s" %
- options.chromeos_root)
- return 1
+ machine_list = options.remotes
+ if len(machine_list) < 2:
+ PrintUsage("ERROR: Must specify at least two machines.")
+ return 1
+ elif not os.path.exists(options.chromeos_root):
+ PrintUsage("Error: chromeos_root does not exist %s" %
+ options.chromeos_root)
+ return 1
- chroot = options.chromeos_root
- cros_machines = []
- test_machine_checksum = None
- for m in machine_list:
- cm = CrosMachine(m, chroot, 'average')
- cros_machines = cros_machines + [ cm ]
- test_machine_checksum = cm.machine_checksum
+ chroot = options.chromeos_root
+ cros_machines = []
+ test_machine_checksum = None
+ for m in machine_list:
+ cm = CrosMachine(m, chroot, 'average')
+ cros_machines = cros_machines + [cm]
+ test_machine_checksum = cm.machine_checksum
- retval = 0
- for cm in cros_machines:
- print "checksum for %s : %s" % (cm.name, cm.machine_checksum)
- if cm.machine_checksum != test_machine_checksum:
- retval = 1
- print "Machine checksums do not all match"
+ ret = 0
+ for cm in cros_machines:
+ print("checksum for %s : %s" % (cm.name, cm.machine_checksum))
+ if cm.machine_checksum != test_machine_checksum:
+ ret = 1
+ print("Machine checksums do not all match")
- if retval == 0:
- print "Machines all match."
+ if ret == 0:
+ print("Machines all match.")
- return retval
+ return ret
if __name__ == '__main__':
- retval = Main(sys.argv[1:])
- sys.exit(retval)
-
+ retval = Main(sys.argv[1:])
+ sys.exit(retval)