[Trac-tickets] [The Trac Project] #2329: plugins may fail to load
on windows
The Trac Project
noreply at edgewall.com
Wed Nov 9 11:30:17 CST 2005
#2329: plugins may fail to load on windows
----------------------------------------------+-----------------------------
Reporter: Geoff Reedy <gereedy at sandia.gov> | Owner: jonas
Type: defect | Status: new
Priority: normal | Milestone: 0.9.1
Component: general | Version: 0.9
Severity: normal | Keywords: |
----------------------------------------------+-----------------------------
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.
{{{
#!patch
Index: trac/loader.py
===================================================================
--- trac/loader.py (revision 2522)
+++ trac/loader.py (working copy)
@@ -26,6 +26,12 @@
__all__ = ['load_components']
+def normalize_path(s):
+ return os.path.normcase(os.path.abspath(s))
+
+def paths_equal(path1, path2):
+ return normalize_path(path1) == normalize_path(path2)
+
def load_components(env):
loaded_components = []
@@ -45,7 +51,7 @@
def enable_modules(egg_path, modules):
"""Automatically enable any components provided by plugins loaded
from
the environment plugins directory."""
- if os.path.dirname(egg_path) == os.path.realpath(plugins_dir):
+ if paths_equal(os.path.dirname(egg_path),
os.path.realpath(plugins_dir)):
for module in modules:
env.config.setdefault('components', module + '.*',
'enabled')
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2329>
The Trac Project <http://trac.edgewall.com/>
More information about the Trac-Tickets
mailing list