summaryrefslogtreecommitdiffstats
path: root/server/module_loader.py
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2007-09-20 17:21:51 -0400
committerAdrian Likins <alikins@redhat.com>2007-09-20 17:21:51 -0400
commit8d04809a4db0b6c4d57eb8f6455239409255b5ea (patch)
treec9a0c46e75e7103328efde618d0ad81649912092 /server/module_loader.py
parent7a70b5bb80c69dafc345dfd4df577bfb1e983ee9 (diff)
downloadthird_party-func-8d04809a4db0b6c4d57eb8f6455239409255b5ea.tar.gz
third_party-func-8d04809a4db0b6c4d57eb8f6455239409255b5ea.tar.xz
third_party-func-8d04809a4db0b6c4d57eb8f6455239409255b5ea.zip
attempts at letting us run from a installed, or local modules
there are smarter ways to do this I'm sure
Diffstat (limited to 'server/module_loader.py')
-rwxr-xr-xserver/module_loader.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/server/module_loader.py b/server/module_loader.py
index 10631fe..3f73500 100755
--- a/server/module_loader.py
+++ b/server/module_loader.py
@@ -7,19 +7,33 @@ 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(module_path=None,
+ blacklist=None):
+
+ print "\n\n\n\n\n why the heck is this getting called twice? \n\n\n"
+
+ module_file_path="%s/func/server/modules/" % distutils.sysconfig.get_python_lib()
+ mod_path="%s/func/server/" % distutils.sysconfig.get_python_lib()
+
+ if module_path is not None:
+ module_file_path="%s/modules" % module_path
+ mod_path = module_path
+
+ sys.path.insert(0, mod_path)
mods = {}
print sys.path
+ print mod_path
+ print module_file_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)
+
+
+ print "filenames", filenames
for fn in filenames:
basename = os.path.basename(fn)
if basename == "__init__.py":
@@ -31,6 +45,10 @@ def load_modules(module_path=module_file_path, blacklist=None):
try:
+ path = "server.module.%s" % modname
+ if module_path is None:
+ path = "module.%s" % modname
+
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")
@@ -46,8 +64,4 @@ def load_modules(module_path=module_file_path, blacklist=None):
-
-if __name__ == "__main__":
- print load_modules(module_path)
-