From: Zac Medico Date: Fri, 26 Feb 2010 23:48:56 +0000 (-0000) Subject: Eliminate the PhaseCheck constructor and make PhaseCheck.phases_re a class X-Git-Tag: v2.2_rc64~43 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=07459b70f074e2de6bb171c9c31afb6420426e94;p=portage.git 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 --- 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: