diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-07-02 08:05:06 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-07-02 08:53:04 +0200 |
commit | e6e0150e07be32b91624b460b67be39b8f6b0ab9 (patch) | |
tree | ebf593199d58f8a46d3bbeae3335258c6e264d54 /gbp/deb | |
parent | 92a744e5c8e9751f7336ddaac597ded2a7456d8f (diff) | |
download | git-buildpackage-e6e0150e07be32b91624b460b67be39b8f6b0ab9.tar.gz git-buildpackage-e6e0150e07be32b91624b460b67be39b8f6b0ab9.tar.bz2 git-buildpackage-e6e0150e07be32b91624b460b67be39b8f6b0ab9.zip |
Make exception syntax consistent
Diffstat (limited to 'gbp/deb')
-rw-r--r-- | gbp/deb/__init__.py | 20 | ||||
-rw-r--r-- | gbp/deb/changelog.py | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/gbp/deb/__init__.py b/gbp/deb/__init__.py index 19e78fa8..1f52c5a5 100644 --- a/gbp/deb/__init__.py +++ b/gbp/deb/__init__.py @@ -94,20 +94,20 @@ class DpkgCompareVersions(gbpc.Command): def __init__(self): if not os.access(self.cmd, os.X_OK): - raise GbpError, "%s not found - cannot use compare versions" % self.cmd + raise GbpError("%s not found - cannot use compare versions" % self.cmd) gbpc.Command.__init__(self, self.cmd, ['--compare-versions']) def __call__(self, version1, version2): self.run_error = "Couldn't compare %s with %s" % (version1, version2) res = gbpc.Command.call(self, [ version1, 'lt', version2 ]) if res not in [ 0, 1 ]: - raise gbpc.CommandExecFailed, "%s: bad return code %d" % (self.run_error, res) + raise gbpc.CommandExecFailed("%s: bad return code %d" % (self.run_error, res)) if res == 0: return -1 elif res == 1: res = gbpc.Command.call(self, [ version1, 'gt', version2 ]) if res not in [ 0, 1 ]: - raise gbpc.CommandExecFailed, "%s: bad return code %d" % (self.run_error, res) + raise gbpc.CommandExecFailed("%s: bad return code %d" % (self.run_error, res)) if res == 0: return 1 return 0 @@ -174,13 +174,13 @@ class DscFile(object): f.close() if not self.pkg: - raise GbpError, "Cannot parse package name from '%s'" % self.dscfile + raise GbpError("Cannot parse package name from '%s'" % self.dscfile) elif not self.tgz: - raise GbpError, "Cannot parse archive name from '%s'" % self.dscfile + raise GbpError("Cannot parse archive name from '%s'" % self.dscfile) if not self.upstream_version: - raise GbpError, "Cannot parse version number from '%s'" % self.dscfile + raise GbpError("Cannot parse version number from '%s'" % self.dscfile) if not self.native and not self.debian_version: - raise GbpError, "Cannot parse Debian version number from '%s'" % self.dscfile + raise GbpError("Cannot parse Debian version number from '%s'" % self.dscfile) def _get_version(self): version = [ "", self.epoch + ":" ][len(self.epoch) > 0] @@ -200,8 +200,8 @@ def parse_dsc(dscfile): """parse dsc by creating a DscFile object""" try: dsc = DscFile(dscfile) - except IOError, err: - raise GbpError, "Error reading dsc file: %s" % err + except IOError as err: + raise GbpError("Error reading dsc file: %s" % err) return dsc @@ -217,7 +217,7 @@ def parse_changelog_repo(repo, branch, filename): # repository errors. sha = repo.rev_parse("%s:%s" % (branch, filename)) except GitRepositoryError: - raise NoChangeLogError, "Changelog %s not found in branch %s" % (filename, branch) + raise NoChangeLogError("Changelog %s not found in branch %s" % (filename, branch)) lines = repo.show(sha) return ChangeLog('\n'.join(lines)) diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py index 0f9bace5..b1be4001 100644 --- a/gbp/deb/changelog.py +++ b/gbp/deb/changelog.py @@ -78,7 +78,7 @@ class ChangeLog(object): raise Exception("Either filename or contents must be passed") if filename and not os.access(filename, os.F_OK): - raise NoChangeLogError, "Changelog %s not found" % (filename, ) + raise NoChangeLogError("Changelog %s not found" % (filename, )) if contents: self._contents = contents[:] @@ -109,7 +109,7 @@ class ChangeLog(object): else: cp['Debian-Version'] = cp['NoEpoch-Version'] except TypeError: - raise ParseChangeLogError, output.split('\n')[0] + raise ParseChangeLogError(output.split('\n')[0]) self._cp = cp |