From 6817988b3b9075ee1648c6a6ce64e4e420c7ea80 Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Wed, 19 Dec 2012 13:57:00 +0500 Subject: [PATCH] Slight simplification, non recursive plugin loading, only .py files in plugins folder are going to be loaded now and not in sub-directories --- pluginloader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pluginloader.py b/pluginloader.py index c574267..c9c41c0 100644 --- a/pluginloader.py +++ b/pluginloader.py @@ -12,11 +12,12 @@ class PluginLoader(): def loadPlugins(self, parser): - for root, dirs, files in os.walk(self.path): - for source in (s for s in files if s.endswith(".py")): - name = os.path.splitext(os.path.basename(source))[0] - full_name = os.path.splitext(source)[0].replace(os.path.sep, '.') - m = imp.load_module(full_name, *imp.find_module(name, [root])) + for item in os.listdir(self.path): + split = os.path.splitext(item) + if (split[1] == '.py'): + name = split[0] + full_name = split[0].replace(os.path.sep, '.') + m = imp.load_module(full_name, *imp.find_module(name, [self.path])) pluginClass = None try: