]> git.decadent.org.uk Git - dak.git/commitdiff
Add regex to match .dsc "Format: lala" value and compile it on creation.
authorChris Lamb <lamby@debian.org>
Tue, 27 Oct 2009 10:28:59 +0000 (10:28 +0000)
committerChris Lamb <lamby@debian.org>
Tue, 27 Oct 2009 10:28:59 +0000 (10:28 +0000)
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

index 51df1c60224c66ca16a0e1868bd8c60a8188c612..8bea377591e4c38ff1efc42e63e46338f71ac613 100644 (file)
@@ -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\)'