diff options
Diffstat (limited to 'gbp/deb/uscan.py')
-rw-r--r-- | gbp/deb/uscan.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gbp/deb/uscan.py b/gbp/deb/uscan.py index 4613b960..bd742c79 100644 --- a/gbp/deb/uscan.py +++ b/gbp/deb/uscan.py @@ -129,7 +129,7 @@ class Uscan(object): else: self._uptodate = False - def _raise_error(self, out): + def _maybe_raise_error(self, out): r""" Parse the uscan output for errors and warnings and raise a L{UscanError} exception based on this. If no error detail @@ -140,7 +140,7 @@ class Uscan(object): @raises UscanError: exception raised >>> u = Uscan('http://example.com/') - >>> u._raise_error("<warnings>uscan warning: " + >>> u._maybe_raise_error("<warnings>uscan warning: " ... "In watchfile debian/watch, reading webpage\n" ... "http://a.b/ failed: 500 Cant connect " ... "to example.com:80 (Bad hostname)</warnings>") @@ -148,15 +148,16 @@ class Uscan(object): ... UscanError: Uscan failed: uscan warning: In watchfile debian/watch, reading webpage http://a.b/ failed: 500 Cant connect to example.com:80 (Bad hostname) - >>> u._raise_error("<errors>uscan: Can't use --verbose if " + >>> u._maybe_raise_error("<errors>uscan: Can't use --verbose if " ... "you're using --dehs!</errors>") Traceback (most recent call last): ... UscanError: Uscan failed: uscan: Can't use --verbose if you're using --dehs! - >>> u = u._raise_error('') + >>> u._maybe_raise_error("<warnings>OpenPGP signature did not verify.</warnings>") Traceback (most recent call last): ... - UscanError: Uscan failed - debug by running 'uscan --verbose' + UscanError: Uscan failed: OpenPGP signature did not verify. + >>> u._maybe_raise_error('doesnotmatter') """ msg = None @@ -165,10 +166,8 @@ class Uscan(object): if m: msg = "Uscan failed: %s" % m.group(1) break - - if not msg: - msg = "Uscan failed - debug by running 'uscan --verbose'" - raise UscanError(msg) + if msg: + raise UscanError(msg) def scan(self, destdir='..'): """Invoke uscan to fetch a new upstream version""" @@ -181,9 +180,9 @@ class Uscan(object): # Don't fail in the uptodate case: self._parse_uptodate(out) if not self.uptodate: + self._maybe_raise_error(out) if p.returncode: - self._raise_error(out) - else: - self._parse(out) + raise UscanError("Uscan failed - debug by running 'uscan --verbose'") + self._parse(out) # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: |