[Distutils] Buildout: How to include installed packages in sys.path?
Jim Fulton
jim at zope.com
Fri Feb 12 23:49:33 CET 2010
On Fri, Feb 12, 2010 at 6:48 AM, Gustavo Narea
<gustavonarea at 2degreesnetwork.com> wrote:
> Hello, Jim.
>
> Thank you very much for your response.
>
> I modified by recipe to use zc.recipe.egg like this:
> ====
> from zc.recipe.egg import Scripts
> # ...
> egg = Scripts(buildout, name, options)
> egg.working_set((distribution_name,))
> # ...
> do_something_useful(distribution_name)
> ====
>
> But still do_something_useful() is failing (distribution_name is not in
> sys.path) and I think that's because I didn't use pkg_resources as you
> suggested. I tried to do it, and read the documentation and source code
> for pkg_resources, but I was not able to find the functionality I should
> use.
Change your call to working_set to capture the working set:
requirements, ws = egg.working_set((distribution_name,))
Then:
for dist in ws:
pkg_resources.working_set.add(dist)
Jim
--
Jim Fulton
More information about the Distutils-SIG
mailing list