From 46434f2a671e5382758899140fbbd0fca2fff9b2 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 27 Oct 2009 10:28:59 +0000 Subject: [PATCH] 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 --- daklib/srcformats.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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\)' -- 2.39.5