~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugin.py

  • Committer: Robert Collins
  • Date: 2005-10-16 00:22:17 UTC
  • mto: This revision was merged to the branch mainline in revision 1457.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016002217-aa38f9c1eb13ee48
Plugins are now loaded under bzrlib.plugins, not bzrlib.plugin.

Plugins are also made available for other plugins to use by making them 
accessible via import bzrlib.plugins.NAME. You should not import other
plugins during the __init__ of your plugin though, as no ordering is
guaranteed, and the plugins directory is not on the python path.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
 
26
26
import os
 
27
import bzrlib
27
28
from bzrlib.config import config_dir
28
29
DEFAULT_PLUGIN_PATH = os.path.join(config_dir(), 'plugins')
29
30
 
110
111
                plugin_info = imp.find_module(name, [d])
111
112
                mutter('load plugin %r' % (plugin_info,))
112
113
                try:
113
 
                    plugin = imp.load_module('bzrlib.plugin.' + name,
 
114
                    plugin = imp.load_module('bzrlib.plugins.' + name,
114
115
                                             *plugin_info)
115
116
                    all_plugins.append(plugin)
 
117
                    setattr(bzrlib.plugins, name, plugin)
116
118
                finally:
117
119
                    if plugin_info[0] is not None:
118
120
                        plugin_info[0].close()