Gentoo Archives: gentoo-dev

From: Jason Stubbs <jstubbs@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Plugin framework
Date: Sat, 12 Nov 2005 13:12:52
I've had a go at creating a generic plugin framework for portage. The attached 
patch contains:

* plugins/ that does plugin searching and loading.
* plugins/cache/ which specifies what class cache plugins must
  derive from.
* cache/{anydbm,flat_hash,flat_list,metadata,sqlite}.py copied to
  plugins/cache/ with imports adjusted and classes renamed to match their
* edits to the config class to make use of the framework.

Essentially, plugins.registry gives dict access to modules under plugins/. To 
give an example, the plugins.cache.anydbm.anydbm class can be accessed via

In loading, I'm iterating through sys.path and chopping that out from the 
detected module's path. I didn't need to do this when I was first testing the 
module loader, however. After integrating it with portage I was getting 
"module not found" errors. If anybody knows why that is, I'll get rid of that 
iteration. To be clear, the following doesn't work only when running from 
portage (regardless of the path used):

python -c '__import__("/usr/lib/portage/pym/cache")'


File name MIME type
plugin-framework.patch text/x-diff


Subject Author
Re: [gentoo-dev] Plugin framework Jason Stubbs <jstubbs@g.o>