summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Eckersberg <jeckersb@redhat.com>2008-01-28 12:51:27 -0500
committerJohn Eckersberg <jeckersb@redhat.com>2008-01-28 12:51:27 -0500
commitf099101e300bf7e23ccddcccb4dad73114a834f0 (patch)
tree53c52d3cf1a4dc0094ecfa0260be4dbdaa8cc37f
parent918e3d545150bbaecb6c283dbbd85d67291086e3 (diff)
downloadthird_party-func-f099101e300bf7e23ccddcccb4dad73114a834f0.tar.gz
third_party-func-f099101e300bf7e23ccddcccb4dad73114a834f0.tar.xz
third_party-func-f099101e300bf7e23ccddcccb4dad73114a834f0.zip
Load classes out of __init__ files
Conflicts:
-rwxr-xr-xfunc/minion/module_loader.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/func/minion/module_loader.py b/func/minion/module_loader.py
index 37bc515..3068ea8 100755
--- a/func/minion/module_loader.py
+++ b/func/minion/module_loader.py
@@ -32,9 +32,6 @@ def module_walker(topdir):
for filename in files:
# ASSUMPTION: all module files will end with .py, .pyc, .pyo
if filename[-3:] == ".py" or filename[-4:] == ".pyc" or filename[-4:] == ".pyo":
- # we don't really care about __init__ files, though we do requure them
- if filename[:8] == "__init__":
- continue
# the normpath is important, since we eventually replace /'s with .'s
# in the module name, and foo..bar doesnt work -akl
module_files.append(os.path.normpath("%s/%s" % (root, filename)))
@@ -59,9 +56,10 @@ def load_modules(blacklist=None):
module_name_part = fn[len(module_file_path):]
dirname, basename = os.path.split(module_name_part)
- if basename == "__init__.py":
- continue
- if basename[-3:] == ".py":
+ if basename[:8] == "__init__":
+ modname = dirname
+ dirname = ""
+ elif basename[-3:] == ".py":
modname = basename[:-3]
elif basename[-4:] in [".pyc", ".pyo"]:
modname = basename[:-4]