summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-02-26 23:48:56 +0000
committerZac Medico <zmedico@gentoo.org>2010-02-26 23:48:56 +0000
commit07459b70f074e2de6bb171c9c31afb6420426e94 (patch)
treea013d021b798ab488d66fb1405916f0cf513d48a
parent5ad95bfa14e8eeab408ec35773f48e938608b784 (diff)
downloadportage-07459b70f074e2de6bb171c9c31afb6420426e94.tar.gz
portage-07459b70f074e2de6bb171c9c31afb6420426e94.tar.bz2
portage-07459b70f074e2de6bb171c9c31afb6420426e94.zip
Eliminate the PhaseCheck constructor and make PhaseCheck.phases_re a class
attribute. Thanks to Sebastian Pipping <sping@g.o> for the initial patch. svn path=/main/trunk/; revision=15470
-rw-r--r--pym/repoman/checks.py14
1 files 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: