Edgewall Software

Ticket #2329 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

plugins may fail to load on windows

Reported by: Geoff Reedy <gereedy@…> Owned by: cboos
Priority: normal Milestone: 0.9.1
Component: general Version: 0.9
Severity: normal Keywords:
Cc:

Description

Plugins installed to a project's plugins directory may not be automatically enabled due to windows' case preserving yet case insensitive behavior.

trac.loader directly compares the location of each plugin's egg with the environment's plugin path without normalization, the following patch normalizes the paths before comparing them.

  • trac/loader.py

     
    2626 
    2727__all__ = ['load_components'] 
    2828 
     29def normalize_path(s): 
     30  return os.path.normcase(os.path.abspath(s)) 
     31 
     32def paths_equal(path1, path2): 
     33  return normalize_path(path1) == normalize_path(path2) 
     34 
    2935def load_components(env): 
    3036 
    3137    loaded_components = [] 
     
    4551    def enable_modules(egg_path, modules): 
    4652        """Automatically enable any components provided by plugins loaded from 
    4753        the environment plugins directory.""" 
    48         if os.path.dirname(egg_path) == os.path.realpath(plugins_dir): 
     54        if paths_equal(os.path.dirname(egg_path), os.path.realpath(plugins_dir)): 
    4955            for module in modules: 
    5056                env.config.setdefault('components', module + '.*', 'enabled') 
    5157 

Attachments

Change History

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned

Yep, that's a better fix than what I did in r2471.

Changed 3 years ago by cboos

Patch applied in r2525.

cmlenz, I let you port this on 0.9-stable and close the ticket if you find the change OK.

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Ported to stable in r2532.

Add/Change #2329 (plugins may fail to load on windows)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.