summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-08-07 03:15:10 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-08-07 03:15:10 +0000
commit26e0af54c2eb3efe468715edada97442e469bb19 (patch)
treee9611fe1a4d29f4d6fce41f94ff4a4ec80590312 /utils
parent91142b1125aabd86d2307f340abc53351c4a7d94 (diff)
downloadllvm-26e0af54c2eb3efe468715edada97442e469bb19.tar.gz
llvm-26e0af54c2eb3efe468715edada97442e469bb19.tar.bz2
llvm-26e0af54c2eb3efe468715edada97442e469bb19.tar.xz
[lit] Use more modern syntax for constructing exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/lit/lit/ShCommands.py6
-rw-r--r--utils/lit/lit/ShUtil.py15
-rw-r--r--utils/lit/lit/TestRunner.py2
3 files changed, 13 insertions, 10 deletions
diff --git a/utils/lit/lit/ShCommands.py b/utils/lit/lit/ShCommands.py
index 4550437ce2..7e5812165c 100644
--- a/utils/lit/lit/ShCommands.py
+++ b/utils/lit/lit/ShCommands.py
@@ -20,14 +20,14 @@ class Command:
elif '"' not in arg and '$' not in arg:
quoted = '"%s"' % arg
else:
- raise NotImplementedError,'Unable to quote %r' % arg
+ raise NotImplementedError('Unable to quote %r' % arg)
print >>file, quoted,
# For debugging / validation.
import ShUtil
dequoted = list(ShUtil.ShLexer(quoted).lex())
if dequoted != [arg]:
- raise NotImplementedError,'Unable to quote %r' % arg
+ raise NotImplementedError('Unable to quote %r' % arg)
for r in self.redirects:
if len(r[0]) == 1:
@@ -54,7 +54,7 @@ class Pipeline:
def toShell(self, file, pipefail=False):
if pipefail != self.pipe_err:
- raise ValueError,'Inconsistent "pipefail" attribute!'
+ raise ValueError('Inconsistent "pipefail" attribute!')
if self.negate:
print >>file, '!',
for cmd in self.commands:
diff --git a/utils/lit/lit/ShUtil.py b/utils/lit/lit/ShUtil.py
index 00bb40255c..8a292f46cc 100644
--- a/utils/lit/lit/ShUtil.py
+++ b/utils/lit/lit/ShUtil.py
@@ -116,9 +116,11 @@ class ShLexer:
reference = self.lex_arg_slow(c)
if res is not None:
if res != reference:
- raise ValueError,"Fast path failure: %r != %r" % (res, reference)
+ raise ValueError("Fast path failure: %r != %r" % (
+ res, reference))
if self.pos != end:
- raise ValueError,"Fast path failure: %r != %r" % (self.pos, end)
+ raise ValueError("Fast path failure: %r != %r" % (
+ self.pos, end))
return reference
def lex_arg(self, c):
@@ -186,9 +188,9 @@ class ShParser:
def parse_command(self):
tok = self.lex()
if not tok:
- raise ValueError,"empty command!"
+ raise ValueError("empty command!")
if isinstance(tok, tuple):
- raise ValueError,"syntax error near unexpected token %r" % tok[0]
+ raise ValueError("syntax error near unexpected token %r" % tok[0])
args = [tok]
redirects = []
@@ -213,7 +215,7 @@ class ShParser:
op = self.lex()
arg = self.lex()
if not arg:
- raise ValueError,"syntax error near token %r" % op[0]
+ raise ValueError("syntax error near token %r" % op[0])
redirects.append((op, arg))
return Command(args, redirects)
@@ -235,7 +237,8 @@ class ShParser:
assert isinstance(operator, tuple) and len(operator) == 1
if not self.look():
- raise ValueError, "missing argument to operator %r" % operator[0]
+ raise ValueError(
+ "missing argument to operator %r" % operator[0])
# FIXME: Operator precedence!!
lhs = Seq(lhs, operator[0], self.parse_pipeline())
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index d904616127..548f6f532b 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -66,7 +66,7 @@ def executeShCmd(cmd, cfg, cwd, results):
res = executeShCmd(cmd.rhs, cfg, cwd, results)
return res
- raise ValueError,'Unknown shell command: %r' % cmd.op
+ raise ValueError('Unknown shell command: %r' % cmd.op)
assert isinstance(cmd, ShUtil.Pipeline)
procs = []