2 # Copyright (C) 2007 Marco Ferragina <marco.ferragina@gmail.com>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 Load all checkers modules and return a list
25 path
= os
.path
.abspath(os
.path
.dirname(__file__
))
26 checkers_path
= os
.path
.join("..", "checkers")
27 path
= os
.path
.join(path
, checkers_path
)
29 modules
= [x
.split( '.' )[ 0 ] for x
in os
.listdir( path
) \
30 if x
.endswith( '.py' ) and not x
.startswith( '_' ) \
32 __import__("checkers", globals(), locals(), [])
37 mod
= __import__( "checkers" + '.' + m
, globals(), locals(), [] )
38 checkers
.append(getattr(mod
, m
))
39 except ImportError, e
:
40 print 'Exception importing ' + m
+ '\n' + str(e
)
43 def get_checker_by_name(name
):
45 Return the checker named name
47 checkers
= load_checkers()
50 if tmp
.get_name() == name
:
54 def get_checker_info_by_name(name
):
56 Return the Info object for the checker named name
58 checker
= get_checker_by_name(name
)
59 if checker
is not None: