1 |
Author: zmedico |
2 |
Date: 2010-02-26 23:48:56 +0000 (Fri, 26 Feb 2010) |
3 |
New Revision: 15470 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/repoman/checks.py |
7 |
Log: |
8 |
Eliminate the PhaseCheck constructor and make PhaseCheck.phases_re a class |
9 |
attribute. Thanks to Sebastian Pipping <sping@g.o> for the initial patch. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/repoman/checks.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/repoman/checks.py 2010-02-25 22:31:50 UTC (rev 15469) |
15 |
+++ main/trunk/pym/repoman/checks.py 2010-02-26 23:48:56 UTC (rev 15470) |
16 |
@@ -35,17 +35,13 @@ |
17 |
|
18 |
ignore_line = re.compile(r'(^\s*#)') |
19 |
func_end_re = re.compile(r'^\}$') |
20 |
+ phases_re = re.compile('(%s)' % '|'.join(( |
21 |
+ 'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', |
22 |
+ 'src_configure', 'src_compile', 'src_test', 'src_install', |
23 |
+ 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', |
24 |
+ 'pkg_config'))) |
25 |
in_phase = '' |
26 |
|
27 |
- def __init__(self): |
28 |
- self.phases = ('pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', 'src_configure', 'src_compile', |
29 |
- 'src_test', 'src_install', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_config') |
30 |
- phase_re = '(' |
31 |
- for phase in self.phases: |
32 |
- phase_re += phase + '|' |
33 |
- phase_re = phase_re[:-1] + ')' |
34 |
- self.phases_re = re.compile(phase_re) |
35 |
- |
36 |
def check(self, num, line): |
37 |
m = self.phases_re.match(line) |
38 |
if m is not None: |