Slight simplification, non recursive plugin loading, only .py files in plugins folder are going to be loaded now and not in sub-directories

This commit is contained in:
Ammar Askar committed 2012-12-19 13:57:00 +05:00
1 parent 9f076a6f37
commit 6817988b3b
1 file changed
+6 -5
+6 -5
View File
@@ -12,11 +12,12 @@ class PluginLoader():
def loadPlugins(self, parser): def loadPlugins(self, parser):
for root, dirs, files in os.walk(self.path): for item in os.listdir(self.path):
for source in (s for s in files if s.endswith(".py")): split = os.path.splitext(item)
name = os.path.splitext(os.path.basename(source))[0] if (split[1] == '.py'):
full_name = os.path.splitext(source)[0].replace(os.path.sep, '.') name = split[0]
m = imp.load_module(full_name, *imp.find_module(name, [root])) full_name = split[0].replace(os.path.sep, '.')
m = imp.load_module(full_name, *imp.find_module(name, [self.path]))
pluginClass = None pluginClass = None
try: try: