From 43e60bb76e80c6ca7be1ee1da582fe78c5465349 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 29 Apr 2013 20:55:40 +0200 Subject: Make parse_dsc a classmethod of DscFile so we have the object creation close to the object itself. --- gbp/deb/__init__.py | 11 ----------- gbp/deb/dscfile.py | 8 ++++++++ 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'gbp/deb') diff --git a/gbp/deb/__init__.py b/gbp/deb/__init__.py index bff4783..41fc8fd 100644 --- a/gbp/deb/__init__.py +++ b/gbp/deb/__init__.py @@ -26,7 +26,6 @@ from gbp.git import GitRepositoryError # Make sure these are available with 'import gbp.deb' from gbp.deb.changelog import ChangeLog, NoChangeLogError from gbp.deb.policy import DebianPkgPolicy -from gbp.deb.dscfile import DscFile class DpkgCompareVersions(gbpc.Command): cmd='/usr/bin/dpkg' @@ -52,16 +51,6 @@ class DpkgCompareVersions(gbpc.Command): return 0 -def parse_dsc(dscfile): - """parse dsc by creating a DscFile object""" - try: - dsc = DscFile(dscfile) - except IOError as err: - raise GbpError("Error reading dsc file: %s" % err) - - return dsc - - def parse_changelog_repo(repo, branch, filename): """ Parse the changelog file from given branch in the git 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\:·: -- cgit v1.2.3