Explorar el Código

Fixed defect with double loading of the same plugin.

avkonst hace 11 años
padre
commit
afa1a6b761
Se han modificado 3 ficheros con 4 adiciones y 13 borrados
  1. 0 4
      mainline/metrixpp.py
  2. 2 2
      mainline/mpp/internal/dbwrap.py
  3. 2 7
      mainline/mpp/internal/loader.py

+ 0 - 4
mainline/metrixpp.py

@@ -59,10 +59,6 @@ def start():
     ts = time.time()
     mpp.log.set_default_format()
 
-    # TODO remove, logging enabled at earlier stage to track down a problem with loader    
-    os.environ['METRIXPLUSPLUS_LOG_LEVEL'] = 'DEBUG'
-    logging.getLogger().setLevel(logging.DEBUG)
-    
     exit_code = main()
     time_spent = round((time.time() - ts), 2)
     if 'METRIXPLUSPLUS_TEST_GENERATE_GOLDS' in os.environ.keys() and \

+ 2 - 2
mainline/mpp/internal/dbwrap.py

@@ -710,6 +710,6 @@ class Database(object):
     def log(self, sql):
         if logging.getLogger().getEffectiveLevel() <= logging.DEBUG:
             pass
-            #logging.debug("[" + str(self.id) + "] Executing query: " + sql)
-            #traceback.print_stack()
+            logging.debug("[" + str(self.id) + "] Executing query: " + sql)
+            traceback.print_stack()
         

+ 2 - 7
mainline/mpp/internal/loader.py

@@ -24,7 +24,6 @@ import sys
 import ConfigParser
 import re
 import optparse
-import logging
 
 class MultiOptionParser(optparse.OptionParser):
     
@@ -121,8 +120,6 @@ class Loader(object):
                 result.append(child)
             return result
 
-        logging.debug("Additional plugin loading locations: " + str(directories))
-
         # configure python path for loading
         std_ext_dir = os.path.join(os.environ['METRIXPLUSPLUS_INSTALL_DIR'], 'ext')
         std_ext_priority_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -141,12 +138,12 @@ class Loader(object):
             for each in list_dependants_recursively(inicontainer, name):
                 if each not in required_and_dependant_plugins:
                     required_and_dependant_plugins.append(each)
-            required_and_dependant_plugins.append(name)
+            if name not in required_and_dependant_plugins:
+                required_and_dependant_plugins.append(name)
             
         # load
         for plugin_name in required_and_dependant_plugins:
             item = inicontainer.hash[plugin_name]
-            logging.debug("Loading plugin: " + str(item['package']) + ' ' + str(item['module']))
             plugin = __import__(item['package'], globals(), locals(), [item['module']], -1)
             module_attr = plugin.__getattribute__(item['module'])
             class_attr = module_attr.__getattribute__(item['class'])
@@ -181,9 +178,7 @@ class Loader(object):
 
         for item in self.iterate_plugins():
             if (isinstance(item, mpp.api.IConfigurable)):
-                logging.debug("declaring options for " + item.get_name())
                 item.declare_configuration(optparser)
-                logging.debug("after has option std.code.lines.code " + str(optparser.has_option('--std.code.lines.code')))
 
         (options, args) = optparser.parse_args(args)
         for item in self.iterate_plugins():