summaryrefslogtreecommitdiff
path: root/gbp/deb/dscfile.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-04-29 20:55:40 +0200
committerGuido Günther <agx@sigxcpu.org>2013-04-29 21:14:18 +0200
commit43e60bb76e80c6ca7be1ee1da582fe78c5465349 (patch)
tree415cea02d452df14d26c25344601c7be3b03fe9b /gbp/deb/dscfile.py
parent45c2346f6a52aec196dd89b8d09d8b06d05b8867 (diff)
Make parse_dsc a classmethod of DscFile
so we have the object creation close to the object itself.
Diffstat (limited to 'gbp/deb/dscfile.py')
-rw-r--r--gbp/deb/dscfile.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gbp/deb/dscfile.py b/gbp/deb/dscfile.py
index 6f450e2..abaf690 100644
--- a/gbp/deb/dscfile.py
+++ b/gbp/deb/dscfile.py
@@ -110,4 +110,12 @@ class DscFile(object):
def __str__(self):
return "<%s object %s>" % (self.__class__.__name__, self.dscfile)
+ @classmethod
+ def parse(cls, filename):
+ try:
+ dsc = cls(filename)
+ except IOError as err:
+ raise GbpError("Error reading dsc file: %s" % err)
+ return dsc
+
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: