Edgewall Software

Ticket #4317: LoaderAdditionalDirs.diff

File LoaderAdditionalDirs.diff, 1.2 KB (added by ilias@…, 5 years ago)
  • loader.py

     
    3131 
    3232__all__ = ['load_components'] 
    3333 
    34 def load_components(env): 
     34def load_components(env, further_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 further_dirs: 
     41        plugins_dirs.extend( further_dirs ) 
     42 
    4043    # First look for Python source files in the plugins directories, which 
    4144    # simply get imported, thereby registering them with the component manager 
    4245    # if they define any components. 
     
    4649        for plugin_file in plugin_files: 
    4750            try: 
    4851                plugin_name = os.path.basename(plugin_file[:-3]) 
     52                # do not process setup.py files 
     53                if plugin_name == 'setup': 
     54                    continue 
    4955                if plugin_name not in loaded_components: 
    5056                    env.log.debug('Loading file plugin %s from %s' % \ 
    5157                                  (plugin_name, plugin_file))