From d2a4effa7138d04402928b843ca8ca4ba45e3380 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 27 Oct 2009 10:25:59 +0000 Subject: [PATCH] Add SourceFormat class and track definitions with metaclass Signed-off-by: Chris Lamb --- daklib/srcformats.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 daklib/srcformats.py 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 -- 2.39.5