SYS.stdout.flush()
rc = OS.spawnvp(OS.P_WAIT, args[0], args)
if rc != 0:
- raise SubprocessError, rc
+ raise SubprocessError(rc)
def hexhyphens(bytes):
"""
if line[-1] == '\n': line = line[:-1]
match = rx_keyval.match(line)
if not match:
- raise ConfigFileError, "%s:%d: bad line `%s'" % (f, lno, line)
+ raise ConfigFileError("%s:%d: bad line `%s'" % (f, lno, line))
k, v = match.groups()
conf[k] = conf_subst(v)
## Verify the signature
want = C.bytes(rx_nonalpha.sub('', conf['hk-master']))
got = fingerprint('repos/master.pub', 'master-%d' % seq)
- if want != got: raise VerifyError
+ if want != got: raise VerifyError()
run('''catsign -krepos/master.pub verify -avC -kmaster-%d
-t${sig-fresh} tripe-keys.sig tripe-keys.tar.gz''' % seq)
from cStringIO import StringIO
try:
- if OS.getenv('TRIPEMON_FORCE_GI'): raise ImportError
+ if OS.getenv('TRIPEMON_FORCE_GI'): raise ImportError()
import pygtk
pygtk.require('2.0')
import gtk as G
ValidationError.
"""
if not me.validp:
- raise ValidationError
+ raise ValidationError()
return G.Entry.get_text(me)
def numericvalidate(min = None, max = None):
"""
addr = me._namemap[host]
if addr is None:
- raise KeyError, host
+ raise KeyError(host)
return addr
def _resolved(me, host, addr):
pass
else:
if threadp:
- raise InheritanceCycleError, (key, path)
+ raise InheritanceCycleError(key, path)
## See whether the answer is ready waiting for us.
try:
value = v
winner = pp
elif value != v:
- raise AmbiguousOptionError, (key, winner, value, pp, v)
+ raise AmbiguousOptionError(key, winner, value, pp, v)
## That's the best we could manage.
path.pop()
else:
value, _ = me._get(sec, key)
if value is None:
- raise MissingKeyException, (sec, key)
+ raise MissingKeyException(sec, key)
## Expand the value and return it.
return me._expand(sec, value, resolvep)
global active
_debug('> _switchto(%s, %s, %s)' % (cr, arg, exc))
if not cr.livep:
- raise ValueError, 'coroutine is dead'
+ raise ValueError('coroutine is dead')
cr._arg = arg
cr._exc = exc
if cr is active:
try:
if OS.getenv('TRIPE_FORCE_RMCR') is not None:
- raise ImportError
+ raise ImportError()
from py.magic import greenlet as _Coroutine
except ImportError:
from rmcr import Coroutine as _Coroutine
"""
me.dcr = Coroutine.getcurrent().parent
if me.dcr is None:
- raise ValueError, 'must invoke from coroutine'
+ raise ValueError('must invoke from coroutine')
me.filter = filter or (lambda x: x)
if bg:
words = [words[0], '-background', dispatcher.bgtag()] + list(words[1:])
if code == 'INFO':
return me.filter(rest)
elif code == 'OK':
- raise StopIteration
+ raise StopIteration()
elif code == 'CONNERR':
if rest is None:
- raise TripeConnectionError, 'connection terminated by user'
+ raise TripeConnectionError('connection terminated by user')
else:
raise rest
elif code == 'FAIL':
raise TripeError(*rest)
else:
- raise TripeInternalError \
- ('unexpected tripe response %r' % ([code] + rest))
+ raise TripeInternalError('unexpected tripe response %r' %
+ ([code] + rest))
### Simple utility functions for the TripeCommandIterator convenience
### methods.
"""
if (me.min is not None and len(args) < me.min) or \
(me.max is not None and len(args) > me.max):
- raise TripeSyntaxError
+ raise TripeSyntaxError()
me.func(*args)
class TripeServiceJob (Coroutine):
if len(me.args) == 0 or \
len(me.args[0]) < 2 or \
not me.args[0].startswith('-'):
- raise StopIteration
+ raise StopIteration()
opt = me.args.pop(0)
if opt == '--':
- raise StopIteration
+ raise StopIteration()
if opt not in me.allowed:
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return opt
def arg(me):
If none is available, raise `TripeSyntaxError'.
"""
if len(me.args) == 0:
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return me.args.pop(0)
def rest(me, min = None, max = None):
"""
if (min is not None and len(me.args) < min) or \
(max is not None and len(me.args) > max):
- raise TripeSyntaxError
+ raise TripeSyntaxError()
return me.args
###----- That's all, folks --------------------------------------------------
pats = p
break
else:
- raise T.TripeJobError, 'unknown-group', g
+ raise T.TripeJobError('unknown-group', g)
for t, p, a, m in pats:
T.svcinfo('peer', t,
'target', p or '(default)',