Merge lp:~stefanor/ibid/autoload-plugins into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Stefano Rivera
Status: Merged
Approved by: Stefano Rivera
Approved revision: 589
Merged at revision: 590
Proposed branch: lp:~stefanor/ibid/autoload-plugins
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: None lines
To merge this branch: bzr merge lp:~stefanor/ibid/autoload-plugins
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Ibid Core Team Pending
Review via email: mp+4571@code.launchpad.net
To post a comment you must log in.
lp:~stefanor/ibid/autoload-plugins updated
586. By Stefano Rivera

Allow restricting autoloading features within the plugin, and allow loading / skipping on a feature level

Revision history for this message
Michael Gorven (mgorven) wrote :

I'm not convinced about the feature level loading, particularly the
no_autoload attribute at module level. I won't be opposed to merging however
if everyone else is happy.
 review abstain

review: Abstain
Revision history for this message
Jonathan Hitchcock (vhata) wrote :

I can't make up my mind about this - I also think it's a bit messy.

Maybe some more discussion is needed... Whiteboard?

review: Abstain
lp:~stefanor/ibid/autoload-plugins updated
587. By Stefano Rivera

Plugin-level rather than feature-level

Revision history for this message
Stefano Rivera (stefanor) wrote :

r587 is plugin-level rather than feature-level

Revision history for this message
Michael Gorven (mgorven) wrote :

Looking better, but I don't like that adding a processor to the load list
causes other processors in that plugin not to be autoload.
 review needs_fixing

review: Needs Fixing
lp:~stefanor/ibid/autoload-plugins updated
588. By Stefano Rivera

Change loading / skipping logic to be more intuitive. Loading a single Processor doesn't block the rest from loading

589. By Stefano Rivera

Rename skip to noload

Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/config.ini'
--- ibid/config.ini 2009-03-16 21:33:13 +0000
+++ ibid/config.ini 2009-03-17 07:19:20 +0000
@@ -1,4 +1,3 @@
1load = core, basic, info, log, http, irc, seen, identity, admin, auth, help, test, sources, config, bzr, network, factoid, roshambo, eval, crypto, tools, morse, dict, lookup, url, google, memo, karma, feeds, trac, buildbot, apt, misc, math, imdb
2botname = Ibid1botname = Ibid
3logging = logging.ini2logging = logging.ini
43
54
=== modified file 'ibid/core.py'
--- ibid/core.py 2009-03-16 21:00:23 +0000
+++ ibid/core.py 2009-03-17 07:19:20 +0000
@@ -4,6 +4,7 @@
4from os.path import join, expanduser4from os.path import join, expanduser
55
6from twisted.internet import reactor, threads6from twisted.internet import reactor, threads
7from twisted.python.modules import getModule
7from sqlalchemy import create_engine8from sqlalchemy import create_engine
8from sqlalchemy.orm import sessionmaker, scoped_session9from sqlalchemy.orm import sessionmaker, scoped_session
910
@@ -122,8 +123,16 @@
122 self.load_source(source)123 self.load_source(source)
123124
124 def load_processors(self):125 def load_processors(self):
125 for processor in ibid.config['load']:126 if 'load' in ibid.config.plugins:
126 self.load_processor(processor)127 plugins = set(ibid.config.plugins['load'])
128 else:
129 plugins = set(plugin.name.replace('ibid.plugins.', '') for plugin in getModule('ibid.plugins').iterModules())
130
131 if 'skip' in ibid.config.plugins:
132 plugins -= set(ibid.config.plugins['skip'])
133
134 for plugin in plugins:
135 self.load_processor(plugin)
127136
128 def load_processor(self, name):137 def load_processor(self, name):
129 object = name138 object = name
130139
=== modified file 'scripts/ibid-plugin'
--- scripts/ibid-plugin 2009-03-16 20:55:20 +0000
+++ scripts/ibid-plugin 2009-03-17 07:19:20 +0000
@@ -10,6 +10,8 @@
10except ImportError:10except ImportError:
11 pass11 pass
1212
13from twisted.python.modules import getModule
14
13import ibid15import ibid
14import ibid.plugins16import ibid.plugins
15from ibid.config import FileConfig17from ibid.config import FileConfig
@@ -18,11 +20,13 @@
1820
19parser = OptionParser(usage="%prog [options...] [plugins...]")21parser = OptionParser(usage="%prog [options...] [plugins...]")
20parser.add_option("-a", "--all", dest="load_all", action="store_true",22parser.add_option("-a", "--all", dest="load_all", action="store_true",
21 help="Load all configured plugins")23 help="Load all available plugins")
22parser.add_option("-o", "--only", dest="load_base", action="store_false", default=True,24parser.add_option("-o", "--only", dest="load_base", action="store_false", default=True,
23 help="Only load the specified plugins, not the common base plugins")25 help="Only load the specified plugins, not the common base plugins")
24parser.add_option("-s", "--skip", dest="skip", action="append", metavar="PLUGIN",26parser.add_option("-s", "--skip", dest="skip", action="append", metavar="PLUGIN",
25 help="Skip loading PLUGIN (may be specified more than once)")27 help="Skip loading PLUGIN (may be specified more than once)")
28parser.add_option("-c", "--configured", dest="load_configured", action="store_true",
29 help="Load all all configured plugins")
2630
27(options, args) = parser.parse_args()31(options, args) = parser.parse_args()
2832
@@ -50,10 +54,17 @@
50ibid.sources[u'test_source'] = TestSource()54ibid.sources[u'test_source'] = TestSource()
5155
52plugins = set(args)56plugins = set(args)
53if options.load_all:57if options.load_all or options.load_configured:
54 plugins = set(ibid.config.get("load"))58 plugins = set(module.name.replace('ibid.plugins.', '') for module in getModule('ibid.plugins').iterModules())
55if options.load_base:59
60if options.load_configured:
61 if 'load' in ibid.config.plugins:
62 plugins = set(ibid.config.plugins['load'])
63 if 'skip' in ibid.config.plugins:
64 plugins -= set(ibid.config.plugins['skip'])
65elif options.load_base:
56 plugins |= set(("admin", "config", "core", "help", "test"))66 plugins |= set(("admin", "config", "core", "help", "test"))
67
57if options.skip:68if options.skip:
58 plugins -= set(options.skip)69 plugins -= set(options.skip)
5970

Subscribers

People subscribed via source and target branches