Merge pull request #5711 from sivel/plugin-realpath

Use realpath for plugin directories instead of abspath
This commit is contained in:
Michael DeHaan 2014-03-16 15:42:47 -05:00
commit fd0ff6f174

View file

@ -30,7 +30,7 @@ _basedirs = []
def push_basedir(basedir): def push_basedir(basedir):
# avoid pushing the same absolute dir more than once # avoid pushing the same absolute dir more than once
basedir = os.path.abspath(basedir) basedir = os.path.realpath(basedir)
if basedir not in _basedirs: if basedir not in _basedirs:
_basedirs.insert(0, basedir) _basedirs.insert(0, basedir)
@ -99,7 +99,7 @@ class PluginLoader(object):
ret = [] ret = []
ret += self._extra_dirs ret += self._extra_dirs
for basedir in _basedirs: for basedir in _basedirs:
fullpath = os.path.abspath(os.path.join(basedir, self.subdir)) fullpath = os.path.realpath(os.path.join(basedir, self.subdir))
if os.path.isdir(fullpath): if os.path.isdir(fullpath):
files = glob.glob("%s/*" % fullpath) files = glob.glob("%s/*" % fullpath)
for file in files: for file in files:
@ -111,7 +111,7 @@ class PluginLoader(object):
# look in any configured plugin paths, allow one level deep for subcategories # look in any configured plugin paths, allow one level deep for subcategories
configured_paths = self.config.split(os.pathsep) configured_paths = self.config.split(os.pathsep)
for path in configured_paths: for path in configured_paths:
path = os.path.abspath(os.path.expanduser(path)) path = os.path.realpath(os.path.expanduser(path))
contents = glob.glob("%s/*" % path) contents = glob.glob("%s/*" % path)
for c in contents: for c in contents:
if os.path.isdir(c) and c not in ret: if os.path.isdir(c) and c not in ret:
@ -131,7 +131,7 @@ class PluginLoader(object):
''' Adds an additional directory to the search path ''' ''' Adds an additional directory to the search path '''
self._paths = None self._paths = None
directory = os.path.abspath(directory) directory = os.path.realpath(directory)
if directory is not None: if directory is not None:
if with_subdir: if with_subdir: