[dak/master 12/29] Add regex to match .dsc "Format: lala" value and compile it on creation.
This forces every format to have a regex too as it will blow up otherwise.
Signed-off-by: Chris Lamb <lamby@debian.org>
---
daklib/srcformats.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/daklib/srcformats.py b/daklib/srcformats.py
index 51df1c6..8bea377 100644
--- a/daklib/srcformats.py
+++ b/daklib/srcformats.py
@@ -1,3 +1,5 @@
+import re
+
srcformats = []
class SourceFormat(type):
@@ -5,13 +7,21 @@ class SourceFormat(type):
klass = super(SourceFormat, cls).__new__(cls, name, bases, attrs)
srcformats.append(klass)
+ klass.re_format = re.compile(klass.format)
+
return klass
class FormatOne(object):
__metaclass__ = SourceFormat
+ format = r'1.0'
+
class FormatThree(object):
__metaclass__ = SourceFormat
+ format = r'3\.\d+ \(native\)'
+
class FormatThreeQuilt(object):
__metaclass__ = SourceFormat
+
+ format = r'3\.\d+ \(quilt\)'
--
1.6.3.3
Reply to: