From: Chris Lamb Date: Tue, 27 Oct 2009 10:28:59 +0000 (+0000) Subject: Add regex to match .dsc "Format: lala" value and compile it on creation. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=46434f2a671e5382758899140fbbd0fca2fff9b2;p=dak.git 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 --- diff --git a/daklib/srcformats.py b/daklib/srcformats.py index 51df1c60..8bea3775 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\)'