From 07459b70f074e2de6bb171c9c31afb6420426e94 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 26 Feb 2010 23:48:56 +0000 Subject: [PATCH] Eliminate the PhaseCheck constructor and make PhaseCheck.phases_re a class attribute. Thanks to Sebastian Pipping for the initial patch. svn path=/main/trunk/; revision=15470 --- pym/repoman/checks.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 941cb4188..79ba892e6 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -35,17 +35,13 @@ class PhaseCheck(LineCheck): ignore_line = re.compile(r'(^\s*#)') func_end_re = re.compile(r'^\}$') + phases_re = re.compile('(%s)' % '|'.join(( + 'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', + 'src_configure', 'src_compile', 'src_test', 'src_install', + 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', + 'pkg_config'))) in_phase = '' - def __init__(self): - self.phases = ('pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', 'src_configure', 'src_compile', - 'src_test', 'src_install', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_config') - phase_re = '(' - for phase in self.phases: - phase_re += phase + '|' - phase_re = phase_re[:-1] + ')' - self.phases_re = re.compile(phase_re) - def check(self, num, line): m = self.phases_re.match(line) if m is not None: -- 2.26.2