diff options
Diffstat (limited to 'server/module_loader.py')
| -rwxr-xr-x | server/module_loader.py | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/server/module_loader.py b/server/module_loader.py index 10631fe..f189623 100755 --- a/server/module_loader.py +++ b/server/module_loader.py @@ -1,5 +1,19 @@ #!/usr/bin/python +## func +## +## Copyright 2007, Red Hat, Inc +## See AUTHORS +## +## This software may be freely redistributed under the terms of the GNU +## general public license. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## + import distutils.sysconfig import os @@ -7,18 +21,18 @@ import sys import glob from rhpl.translate import _, N_, textdomain, utf8 -module_file_path="modules/" -mod_path="server/" -sys.path.insert(0, mod_path) -def load_modules(module_path=module_file_path, blacklist=None): - filenames = glob.glob("%s/*.py" % module_file_path) - filenames = filenames + glob.glob("%s/*.pyc" % module_file_path) - filesnames = filenames + glob.glob("%s/*.pyo" % module_file_path) +def load_modules(blacklist=None): + + module_file_path="%s/func/server/modules/" % distutils.sysconfig.get_python_lib() + mod_path="%s/func/server/" % distutils.sysconfig.get_python_lib() + sys.path.insert(0, mod_path) mods = {} - print sys.path + filenames = glob.glob("%s/*.py" % module_file_path) + filenames = filenames + glob.glob("%s/*.pyc" % module_file_path) + filesnames = filenames + glob.glob("%s/*.pyo" % module_file_path) for fn in filenames: basename = os.path.basename(fn) @@ -33,8 +47,8 @@ def load_modules(module_path=module_file_path, blacklist=None): try: blip = __import__("modules.%s" % ( modname), globals(), locals(), [modname]) if not hasattr(blip, "register_rpc"): - errmsg = _("%(module_path)s/%(modname)s module not a proper module") - print errmsg % {'module_path': module_path, 'modname':modname} + errmsg = _("%(module_path)s%(modname)s module not a proper module") + print errmsg % {'module_path': module_file_path, 'modname':modname} continue mods[modname] = blip except ImportError, e: @@ -46,8 +60,4 @@ def load_modules(module_path=module_file_path, blacklist=None): - -if __name__ == "__main__": - print load_modules(module_path) - |
