[dak/master 11/29] Add SourceFormat class and track definitions with metaclass
Signed-off-by: Chris Lamb <lamby@debian.org>
---
daklib/srcformats.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
create mode 100644 daklib/srcformats.py
diff --git a/daklib/srcformats.py b/daklib/srcformats.py
new file mode 100644
index 0000000..51df1c6
--- /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
--
1.6.3.3
Reply to: