mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-12 05:02:32 +01:00
Make the error a little more descriptive
This commit is contained in:
parent
5390e58176
commit
b77d6d0afc
17
src/Misc.py
17
src/Misc.py
@ -267,19 +267,20 @@ class Misc(callbacks.Privmsg):
|
|||||||
if name.endswith('.py'):
|
if name.endswith('.py'):
|
||||||
name = name[:-3]
|
name = name[:-3]
|
||||||
return name
|
return name
|
||||||
def getRevisionNumber(module):
|
def getRevisionNumber(module, name):
|
||||||
def getVersion(s):
|
def getVersion(s, n):
|
||||||
try:
|
try:
|
||||||
return s.split(None, 3)[2]
|
return s.split(None, 3)[2]
|
||||||
except:
|
except:
|
||||||
self.log.exception('Couldn\'t get id string: %r', s)
|
self.log.exception('Couldn\'t get id string from module '
|
||||||
|
'%s: %r', n, s)
|
||||||
if hasattr(module, '__revision__'):
|
if hasattr(module, '__revision__'):
|
||||||
if 'supybot' in module.__file__:
|
if 'supybot' in module.__file__:
|
||||||
return getVersion(module.__revision__)
|
return getVersion(module.__revision__, name)
|
||||||
else:
|
else:
|
||||||
for dir in conf.supybot.directories.plugins():
|
for dir in conf.supybot.directories.plugins():
|
||||||
if module.__file__.startswith(dir):
|
if module.__file__.startswith(dir):
|
||||||
return getVersion(module.__revision__)
|
return getVersion(module.__revision__, name)
|
||||||
if len(args) == 1 and '*' not in args[0] and '?' not in args[0]:
|
if len(args) == 1 and '*' not in args[0] and '?' not in args[0]:
|
||||||
# wildcards are handled below.
|
# wildcards are handled below.
|
||||||
name = normalize(args[0])
|
name = normalize(args[0])
|
||||||
@ -319,12 +320,12 @@ class Misc(callbacks.Privmsg):
|
|||||||
if not args:
|
if not args:
|
||||||
# I shouldn't use iteritems here for some reason.
|
# I shouldn't use iteritems here for some reason.
|
||||||
for (name, module) in sys.modules.items():
|
for (name, module) in sys.modules.items():
|
||||||
names.append((name, getRevisionNumber(module)))
|
names.append((name, getRevisionNumber(module, name)))
|
||||||
elif len(args) == 1: # wildcards
|
elif len(args) == 1: # wildcards
|
||||||
pattern = args[0]
|
pattern = args[0]
|
||||||
for (name, module) in sys.modules.items():
|
for (name, module) in sys.modules.items():
|
||||||
if ircutils.hostmaskPatternEqual(pattern, name):
|
if ircutils.hostmaskPatternEqual(pattern, name):
|
||||||
names.append((name, getRevisionNumber(module)))
|
names.append((name, getRevisionNumber(module, name)))
|
||||||
else:
|
else:
|
||||||
for name in args:
|
for name in args:
|
||||||
name = normalize(name)
|
name = normalize(name)
|
||||||
@ -332,7 +333,7 @@ class Misc(callbacks.Privmsg):
|
|||||||
irc.error('I couldn\'t find a Supybot named %s.'%name)
|
irc.error('I couldn\'t find a Supybot named %s.'%name)
|
||||||
return
|
return
|
||||||
module = sys.modules[name]
|
module = sys.modules[name]
|
||||||
names.append((name, getRevisionNumber(module)))
|
names.append((name, getRevisionNumber(module, name)))
|
||||||
names.sort()
|
names.sort()
|
||||||
L = ['%s: %s' % (k, v) for (k, v) in names if v]
|
L = ['%s: %s' % (k, v) for (k, v) in names if v]
|
||||||
irc.reply(utils.commaAndify(L))
|
irc.reply(utils.commaAndify(L))
|
||||||
|
Loading…
Reference in New Issue
Block a user