[Distutils] installing .py plugins to an alternate directory

Andrew Dalke dalke at dalkescientific.com
Sat Dec 5 01:18:08 CET 2009


On Dec 3, 2009, at 7:58 PM, P.J. Eby wrote:
> It wouldn't be so much of a change as an addition.  You'd just add code like this, either before or after your existing loop over the extensions directory:
> 
>     for entry_point in pkg_resources.iter_entry_points('akara'):
>         extension_module = entry_point.load()
>         # do stuff with extension_module

I sent a followup to Tarek's reply on some of the architectural changes I meant, like changing from the current ability to identify/enable/disable/rename web services with text editor to one which I don't know much about and which seems more complicated.

While thinking about this, there's another one I came up with. We use a pre-forking server based on flup. The master starts up and spawns the processes which do the listening. It's these processes which import the extensions. Send a SIGHUP to the master and it restarts the children, which in turn rescan the list of extensions and reimport them.

It appears that pkg_resources does some caching, including using linecache. I can't tell how well it would work if our pluging packages were updated after the main server was running.


				Andrew
				dalke at dalkescientific.com




More information about the Distutils-SIG mailing list