summaryrefslogtreecommitdiffstats
path: root/server/module_loader.py
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2007-09-20 21:28:51 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2007-09-20 21:28:51 -0400
commit8d168259f1cb0af25a7ee342bd1c32cd5bfdd424 (patch)
tree9c1d80b6da18a902b03ba7b21ec6bd0a60aabbfa /server/module_loader.py
parenta83c4bcc40aae7c8b8058d831667ee1e07a969dc (diff)
parent98010f591948fb4bf297c1c0c32def42f766edca (diff)
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/func
* 'master' of ssh://git.fedoraproject.org/git/hosted/func: (27 commits) just a friendly reminder we are not vf_server, change I!*N domain Add virt module. Add test code for virt. add a very simple, very dumb commandline client: Remove messages.pot from po dir, since its automatically generated Get rid of extra / in module loading error pychecker cleanups Add po dir to git Prevent XMLRPC server from printing to console. Catch FuncException when the config file is missing and exit gracefully Implement a quickie service control module Removing VF items + misc cleanup Clean up some speclint warnings Baseobj bites the dust. remove all the --debug "try to run from the src tree" crap debug spew cleanup to protect the unwashed masses from foo poisoning fix up config_data to use ConfigParser correctly attempt to let us run with --debug flag to run from src checkout attempts at letting us run from a installed, or local modules ...
Diffstat (limited to 'server/module_loader.py')
-rwxr-xr-xserver/module_loader.py38
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)
-