Inter-dependant plugin load order

John Arbash Meinel john at arbash-meinel.com
Tue Sep 25 22:23:49 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> On Tue, 2007-09-25 at 09:27 -0400, Kevin Light wrote:
>> Out of curiosity, has there been any documentation or design details
>> on the order of the plug-in loading?  I know that there has been work
>> on the user vs. system plug-in load order but what about alphabetical
>> ordering within a location?  I guess this might also fall under the
>> category of plug-in dependencies.  
>>
>> I've done some preliminary searching and have not found any
>> discussions.  Are there any guidelines for inter-dependant plug-in
>> development?
> 
> Same as any python module; if A depends on B it should do 'import B',
> and if B is not loaded, it will be loaded at that point.
> 
> -Rob

Just to be clear, it should do:

from bzrlib.plugins import other_plugin

We set the python search path appropriately so that once
'load_plugins()' starts, all plugins should be able to use the standard
'import' mechanism to load another plugin.

What we don't guarantee is a fixed ordering (we tend to build up things
to load in a set, which randomizes the ordering). And if a plugin is
depending on another one, it only knows it by name, so the names of the
plugins are fairly fixed. (You can't import bzrlib.plugins.gtk if it is
called bzrlib.plugins.my_custom_gtk_00)

The only limitation I know if is if you wanted 2 plugins to decorate the
same object, but you wanted them to do it in a fixed order. (But such
that the plugins shouldn't really know about eachother to import the
other one.)

But if you are doing that, probably something else needs to be fixed.

John
=:->



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG+XxkJdeBCYSNAAMRAvtkAJ4yOA373z6K1aTGhGK9cqcQMEOB9gCeP8nW
f4wscvK83r7vYGPpkYoDdxc=
=Rxt/
-----END PGP SIGNATURE-----



More information about the bazaar mailing list