From 12b8a1a45d62c00cc4f1bc9d6d44948352c9615f Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 5 Jun 2017 11:46:39 -0700 Subject: [PATCH] Make pylint happy. If we want we can start using print(), but if so let's consistently use it instead of piecemeal. See also https://stackoverflow.com/questions/28694380/pylint-says-unnecessary-parens-after-r-keyword --- debug/gdbserver.py | 2 +- debug/targets.py | 3 ++- debug/testlib.py | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 476e51d..4dc00c4 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -11,7 +11,7 @@ import os import targets import testlib from testlib import assertEqual, assertNotEqual, assertIn -from testlib import assertGreater, assertTrue, assertRegexpMatches, assertLess +from testlib import assertGreater, assertRegexpMatches, assertLess from testlib import GdbTest MSTATUS_UIE = 0x00000001 diff --git a/debug/targets.py b/debug/targets.py index b8557ce..bd177ec 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -26,7 +26,8 @@ class Target(object): def server(self): """Start the debug server that gdb connects to, eg. OpenOCD.""" if self.openocd_config: - return testlib.Openocd(server_cmd=self.server_cmd, config=self.openocd_config) + return testlib.Openocd(server_cmd=self.server_cmd, + config=self.openocd_config) else: raise NotImplementedError diff --git a/debug/testlib.py b/debug/testlib.py index 3d08e9b..8855e24 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -21,12 +21,12 @@ def find_file(path): def compile(args, xlen=32): # pylint: disable=redefined-builtin cc = os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gcc") cmd = [cc, "-g"] - if (xlen == 32): + if xlen == 32: cmd.append("-march=rv32imac") cmd.append("-mabi=ilp32") else: cmd.append("-march=rv64imac") - cmd.append("-mabi=lp64") + cmd.append("-mabi=lp64") for arg in args: found = find_file(arg) if found: @@ -163,9 +163,9 @@ class Openocd(object): else: openocd = os.path.expandvars("$RISCV/bin/riscv-openocd") cmd = [openocd] - if (debug): + if debug: cmd.append("-d") - + # This command needs to come before any config scripts on the command # line, since they are executed in order. cmd += [ @@ -184,7 +184,7 @@ class Openocd(object): if config: f = find_file(config) if f is None: - print("Unable to read file " + config) + print "Unable to read file " + config exit(1) cmd += ["-f", f] @@ -377,9 +377,10 @@ def run_all_tests(module, target, parsed): gdb_cmd = parsed.gdb todo = [] - if (parsed.misaval): + if parsed.misaval: target.misa = int(parsed.misaval, 16) - print "Assuming $MISA value of 0x%x. Skipping ExamineTarget." % target.misa + print "Assuming $MISA value of 0x%x. Skipping ExamineTarget." % \ + target.misa else: todo.append(("ExamineTarget", ExamineTarget)) @@ -418,7 +419,8 @@ def add_test_run_options(parser): parser.add_argument("--gdb", help="The command to use to start gdb.") parser.add_argument("--misaval", - help="Don't run ExamineTarget, just assume the misa value which is specified.") + help="Don't run ExamineTarget, just assume the misa value which is " + "specified.") def header(title, dash='-'): if title: -- 2.30.2