From 150f29dbdeb1e8cf90b6e2673cd0d5d13793f182 Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 11 Mar 2009 19:26:49 -0400 Subject: [PATCH 1/4] scripts: Change tabstop to softtabstop in our modelines Signed-off-by: James Vega --- scripts/supybot | 3 +-- scripts/supybot-adduser | 4 +++- scripts/supybot-botchk | 4 ++-- scripts/supybot-plugin-create | 4 ++-- scripts/supybot-plugin-doc | 2 +- scripts/supybot-plugin-package | 2 +- scripts/supybot-test | 2 +- scripts/supybot-wizard | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/supybot b/scripts/supybot index 5ddd3668a..b3e03edc3 100644 --- a/scripts/supybot +++ b/scripts/supybot @@ -329,7 +329,6 @@ if __name__ == '__main__': import supybot.plugins.Owner as Owner owner = Owner.Class() - #irclib._callbacks.append(owner) if options.profile: import profile @@ -339,4 +338,4 @@ if __name__ == '__main__': main() -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-adduser b/scripts/supybot-adduser index 5f5483bde..7a0162c0c 100644 --- a/scripts/supybot-adduser +++ b/scripts/supybot-adduser @@ -99,7 +99,7 @@ def main(): password = getpass('What is %s\'s password? ' % name) else: password = options.password - + if not options.capabilities: capabilities = [] prompt = 'Would you like to give %s a capability?' % name @@ -125,3 +125,5 @@ if __name__ == '__main__': main() except KeyboardInterrupt: pass + +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index faeb1bd12..bd9730fdf 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -129,5 +129,5 @@ if __name__ == '__main__': sys.exit(ret) else: sys.exit(0) - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: + +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-plugin-create b/scripts/supybot-plugin-create index 9f18ac57f..fd6f88364 100644 --- a/scripts/supybot-plugin-create +++ b/scripts/supybot-plugin-create @@ -105,7 +105,7 @@ class %s(callbacks.Plugin): Class = %s -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: '''.lstrip() # This removes the newlines that precede and follow the text. configTemplate = ''' @@ -282,4 +282,4 @@ if __name__ == '__main__': finished. Obviously, nothing was written, but just run this script again whenever you want to generate a template for a plugin.""") -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-plugin-doc b/scripts/supybot-plugin-doc index 3ebb4194d..22d01de55 100644 --- a/scripts/supybot-plugin-doc +++ b/scripts/supybot-plugin-doc @@ -241,4 +241,4 @@ if __name__ == '__main__': shutil.rmtree(conf.supybot.directories.conf()) shutil.rmtree(conf.supybot.directories.data()) -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=78: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=78: diff --git a/scripts/supybot-plugin-package b/scripts/supybot-plugin-package index d7ee069fd..10bed7911 100644 --- a/scripts/supybot-plugin-package +++ b/scripts/supybot-plugin-package @@ -51,4 +51,4 @@ if __name__ == '__main__': tf.add(dirname, basename, True) tf.close() -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-test b/scripts/supybot-test index 934dd0429..2bec1826e 100644 --- a/scripts/supybot-test +++ b/scripts/supybot-test @@ -203,4 +203,4 @@ if __name__ == '__main__': if hasattr(unittest, 'asserts'): print 'Total asserts: %s' % unittest.asserts -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/scripts/supybot-wizard b/scripts/supybot-wizard index c5527ccb5..1723afef1 100644 --- a/scripts/supybot-wizard +++ b/scripts/supybot-wizard @@ -670,4 +670,4 @@ if __name__ == '__main__': it was done. Unfortunately, I didn't get to write anything to file. Please run the wizard again to completion.""") -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: From 777f69dcf05ceba4a3e0dd8db88f66c7e290672a Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 11 Mar 2009 19:36:13 -0400 Subject: [PATCH 2/4] supybot-plugin-create: Also make a local directory in the plugin directory This is to be used for storing third party modules that the plugin needs to use. The plugin should then import them using universalImport('module', 'local.module') so system-wide/packaged installs of the module are preferred, falling back to the version shipped with the plugin. Signed-off-by: James Vega --- scripts/supybot-plugin-create | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/supybot-plugin-create b/scripts/supybot-plugin-create index fd6f88364..6fcab9256 100644 --- a/scripts/supybot-plugin-create +++ b/scripts/supybot-plugin-create @@ -2,6 +2,7 @@ ### # Copyright (c) 2002-2005, Jeremiah Fincher +# Copyright (c) 2009, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -253,12 +254,13 @@ def main(): if name.endswith('.py'): name = name[:-3] copyright %= (realName, license) + pathname = name # Make the directory. - os.mkdir(name) + os.mkdir(pathname) def writeFile(filename, s): - fd = file(os.path.join(name, filename), 'w') + fd = file(os.path.join(pathname, filename), 'w') try: fd.write(s) finally: @@ -271,6 +273,11 @@ def main(): writeFile('test.py', testTemplate % (copyright, name, name)) writeFile('README.txt', readmeTemplate) + pathname = os.path.join(pathname, 'local') + os.mkdir(pathname) + writeFile('__init__.py', + '# Stub so local is a module, used for third-party modules\n') + print 'Your new plugin template is in the %s directory.' % name if __name__ == '__main__': From 3fd92e7f2490e3dc0dd4c18d243f6ce6126ba42b Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 11 Mar 2009 19:43:23 -0400 Subject: [PATCH 3/4] RSS: Move feedparser to the local directory Signed-off-by: James Vega --- plugins/RSS/local/__init__.py | 1 + plugins/RSS/{our_feedparser.py => local/feedparser.py} | 0 plugins/RSS/plugin.py | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 plugins/RSS/local/__init__.py rename plugins/RSS/{our_feedparser.py => local/feedparser.py} (100%) diff --git a/plugins/RSS/local/__init__.py b/plugins/RSS/local/__init__.py new file mode 100644 index 000000000..e86e97b86 --- /dev/null +++ b/plugins/RSS/local/__init__.py @@ -0,0 +1 @@ +# Stub so local is a module, used for third-party modules diff --git a/plugins/RSS/our_feedparser.py b/plugins/RSS/local/feedparser.py similarity index 100% rename from plugins/RSS/our_feedparser.py rename to plugins/RSS/local/feedparser.py diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index e8961df9a..249c752db 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -42,7 +42,7 @@ import supybot.ircutils as ircutils import supybot.registry as registry import supybot.callbacks as callbacks -feedparser = utils.python.universalImport('feedparser', 'our_feedparser') +feedparser = utils.python.universalImport('feedparser', 'local.feedparser') def getFeedName(irc, msg, args, state): if not registry.isValidRegistryName(args[0]): From 22da325656c94aaa4fd57f0c164e31f12c67202e Mon Sep 17 00:00:00 2001 From: James Vega Date: Wed, 11 Mar 2009 19:58:21 -0400 Subject: [PATCH 4/4] Math: Move convertcore to the local directory There's no need to try importing a system-wide copy (for now) as convertcore is our own munging of convertall's code into a form that's easy for us to use. This may change in the future. Signed-off-by: James Vega --- plugins/Math/local/__init__.py | 1 + plugins/Math/{our_convertcore.py => local/convertcore.py} | 0 plugins/Math/plugin.py | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 plugins/Math/local/__init__.py rename plugins/Math/{our_convertcore.py => local/convertcore.py} (100%) diff --git a/plugins/Math/local/__init__.py b/plugins/Math/local/__init__.py new file mode 100644 index 000000000..e86e97b86 --- /dev/null +++ b/plugins/Math/local/__init__.py @@ -0,0 +1 @@ +# Stub so local is a module, used for third-party modules diff --git a/plugins/Math/our_convertcore.py b/plugins/Math/local/convertcore.py similarity index 100% rename from plugins/Math/our_convertcore.py rename to plugins/Math/local/convertcore.py diff --git a/plugins/Math/plugin.py b/plugins/Math/plugin.py index d50a9bfaa..d3bb5aeb0 100644 --- a/plugins/Math/plugin.py +++ b/plugins/Math/plugin.py @@ -40,7 +40,7 @@ import supybot.utils as utils from supybot.commands import * import supybot.callbacks as callbacks -convertcore = utils.python.universalImport('convertcore', 'our_convertcore') +convertcore = utils.python.universalImport('local.convertcore') baseArg = ('int', 'base', lambda i: i <= 36)