Fixed some bugs in supybot-wizard, reported by Grantbow.

This commit is contained in:
Jeremy Fincher 2005-01-26 13:26:44 +00:00
parent af47a19c1d
commit cb365a430d
1 changed files with 17 additions and 7 deletions

View File

@ -32,9 +32,14 @@
import os import os
import sys import sys
if sys.version_info < (2, 3, 0): def error(s):
sys.stderr.write('This program requires Python >= 2.3.0\n') sys.stderr.write(s)
if not s.endswith(os.linesep):
sys.stderr.write(os.linesep)
sys.exit(-1) sys.exit(-1)
if sys.version_info < (2, 3, 0):
error('This program requires Python >= 2.3.0')
import supybot import supybot
@ -75,9 +80,9 @@ def getPlugins(pluginDirs):
return plugins return plugins
def loadPlugin(name): def loadPlugin(name):
import supybot.Owner as Owner import supybot.plugin as plugin
try: try:
module = Owner.loadPluginModule(name) module = plugin.loadPluginModule(name)
if hasattr(module, 'Class'): if hasattr(module, 'Class'):
return module return module
else: else:
@ -159,8 +164,7 @@ def main():
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if os.name == 'posix': if os.name == 'posix':
if (os.getuid() == 0 or os.geteuid() == 0) and not options.allowRoot: if (os.getuid() == 0 or os.geteuid() == 0) and not options.allowRoot:
sys.stderr.write('Please, don\'t run this as root.\n') error('Please, don\'t run this as root.')
sys.exit(-1)
filename = '' filename = ''
if args: if args:
@ -401,7 +405,13 @@ def main():
plugins = getPlugins(pluginDirs) plugins = getPlugins(pluginDirs)
for s in ('Admin', 'User', 'Channel', 'Misc', 'Config'): for s in ('Admin', 'User', 'Channel', 'Misc', 'Config'):
configurePlugin(loadPlugin(s), advanced) m = loadPlugin(s)
if m is not None:
configurePlugin(m, advanced)
else:
error('There was an error loading one of the core plugins that '
'under almost all circumstances are loaded. Go ahead and '
'fix that error and run this script again.')
clearLoadedPlugins(plugins, conf.supybot.plugins) clearLoadedPlugins(plugins, conf.supybot.plugins)
output("""Now we're going to run you through plugin configuration. There's output("""Now we're going to run you through plugin configuration. There's