Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#2329 closed defect (fixed)

plugins may fail to load on windows

Reported by: Geoff Reedy <gereedy@…> Owned by: Christian Boos
Priority: normal Milestone: 0.9.1
Component: general Version: 0.9
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

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 (0)

Change History (3)

comment:1 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

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

comment:2 by Christian Boos, 19 years ago

Patch applied in r2525.

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

comment:3 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Ported to stable in r2532.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.