Edgewall Software

Ticket #4317: LoaderOptionalSearchdirs.diff

File LoaderOptionalSearchdirs.diff, 1.3 KB (added by ilias@…, 2 years ago)
  • loader.py

     
    3131 
    3232__all__ = ['load_components'] 
    3333 
    34 def load_components(env): 
     34def load_components(env, search_dirs = None): 
    3535    loaded_components = [] 
    3636    plugins_dirs = [os.path.normcase(os.path.realpath(os.path.join(env.path, 
    3737                                                                  'plugins'))), 
    3838                    default_dir('plugins')] 
    3939 
     40    if search_dirs: 
     41        plugins_dirs = search_dirs 
     42        env.log.debug('load_components from alternate search_dirs') 
     43 
    4044    # First look for Python source files in the plugins directories, which 
    4145    # simply get imported, thereby registering them with the component manager 
    4246    # if they define any components. 
     
    4650        for plugin_file in plugin_files: 
    4751            try: 
    4852                plugin_name = os.path.basename(plugin_file[:-3]) 
     53                # do not process setup.py files 
     54                if plugin_name == 'setup': 
     55                    continue 
    4956                if plugin_name not in loaded_components: 
    5057                    env.log.debug('Loading file plugin %s from %s' % \ 
    5158                                  (plugin_name, plugin_file))