mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-30 23:41:06 -05:00
Make plugin loading/reloading case-insensitive.
Since load/reload was the only place where case mattered for plugins, and it tripped up a lot of new users, this should be a nice bit of usability improvement. Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
92be7c255f
commit
a5ec33adeb
@ -32,6 +32,7 @@ import sys
|
|||||||
import imp
|
import imp
|
||||||
import os.path
|
import os.path
|
||||||
import linecache
|
import linecache
|
||||||
|
import re
|
||||||
|
|
||||||
from . import callbacks, conf, log, registry
|
from . import callbacks, conf, log, registry
|
||||||
|
|
||||||
@ -52,6 +53,13 @@ def loadPluginModule(name, ignoreDeprecation=False):
|
|||||||
except EnvironmentError: # OSError, IOError superclass.
|
except EnvironmentError: # OSError, IOError superclass.
|
||||||
log.warning('Invalid plugin directory: %s; removing.', dir)
|
log.warning('Invalid plugin directory: %s; removing.', dir)
|
||||||
conf.supybot.directories.plugins().remove(dir)
|
conf.supybot.directories.plugins().remove(dir)
|
||||||
|
if name not in files:
|
||||||
|
matched_names = filter(lambda x: re.search(r'(?i)^%s$' % (name,), x),
|
||||||
|
files)
|
||||||
|
if len(matched_names) == 1:
|
||||||
|
name = matched_names[0]
|
||||||
|
else:
|
||||||
|
raise ImportError, name
|
||||||
moduleInfo = imp.find_module(name, pluginDirs)
|
moduleInfo = imp.find_module(name, pluginDirs)
|
||||||
try:
|
try:
|
||||||
module = imp.load_module(name, *moduleInfo)
|
module = imp.load_module(name, *moduleInfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user