[Distutils] [zc.buildout] borrowing another part's eggs

Jim Fulton jim at zope.com
Wed Jan 21 18:43:09 CET 2009


On Jan 20, 2009, at 11:37 AM, Pascoe, S (Stephen) wrote:

> Is there a way for a recipe to pick another part's dependencies so  
> that it can do the sys.path[0:0] = [...] magic that  
> zc.buildout.easy_install.scripts does.  I'm trying to add  
> functionality to a zc.recipe.egg buildout by writing a recipe but  
> I'm finding I want to use the working_set configured in the  
> zc.recipe.egg part.  E.g.
>
> """
> [buildout]
> develop-eggs = recipes
> parts = foo bar
>
> [foo]
> recipe = zc.recipe.egg
> eggs = ...
>
> [bar]
> recipe = recipes:myrecipe
> # I want to create scripts that include the eggs installed in foo
> eggs_from = foo
> ...
> """
>
> At the moment the only option I can see is:
>
>  1. Grab config options from the [foo] section and re-parse all  
> options relating to egg configuration (eggs/dependency-links/etc.)
>  2. Call zc.recipe.easy_install.install() to get a working set.
>  3. Write sys.path[0:0] = [...] into my scripts based on the new  
> working set.
>
> It seems a little redundant but the zc.buildout.easy_install.scripts  
> API doesn't quite do what I want.

You can have your recipe extend the zc.recipe.egg:scripts recipe.  See

   http://pypi.python.org/pypi/zc.recipe.egg#egg-recipe-api-for-other-recipes

zc.recipe.testrunner is one of several examples of of doing this.

Then, you'd have:

   [bar]
   recipe = recipes:myrecipe
   eggs = ${foo:eggs}
   ...

Jim

--
Jim Fulton
Zope Corporation




More information about the Distutils-SIG mailing list