From: Chris Lamb Date: Tue, 27 Oct 2009 10:25:59 +0000 (+0000) Subject: Add SourceFormat class and track definitions with metaclass X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d2a4effa7138d04402928b843ca8ca4ba45e3380;p=dak.git Add SourceFormat class and track definitions with metaclass Signed-off-by: Chris Lamb --- diff --git a/daklib/srcformats.py b/daklib/srcformats.py new file mode 100644 index 00000000..51df1c60 --- /dev/null +++ b/daklib/srcformats.py @@ -0,0 +1,17 @@ +srcformats = [] + +class SourceFormat(type): + def __new__(cls, name, bases, attrs): + klass = super(SourceFormat, cls).__new__(cls, name, bases, attrs) + srcformats.append(klass) + + return klass + +class FormatOne(object): + __metaclass__ = SourceFormat + +class FormatThree(object): + __metaclass__ = SourceFormat + +class FormatThreeQuilt(object): + __metaclass__ = SourceFormat