[Distutils] Buildout: Recipes with extras
Phillip J. Eby
pje at telecommunity.com
Thu Feb 15 21:40:36 CET 2007
At 09:19 PM 2/15/2007 +0100, Thomas Lotze wrote:
>Automatic installation of eggs required by an egg extra doesn't seem to
>work for a recipe used with zc.buildout as documented for eggs in general:
>
>Suppose myrecipe has two entry points, the "fancy" one employing
>yourrecipe. Now if I declare yourrecipe as an extra requirement only to be
>installed if the "fancy" entry point is used to install any buildout part:
>
>myrecipe/setup.py:
>
>...
>
>setup(...
> entry_points={"zc.buildout": [
> "default = myrecipe.foo:Recipe",
> "fancy = myrecipe.bar:Recipe [bar_extra]",
> ]},
> extras_require={"bar_extra": ["yourrecipe"]},
> ...
> )
>
>and use myrecipe I get a pkg_resources.DistributionNotFound error
>concerning yourrecipe. It sort of works if I manually copy the yourrecipe
>egg to the eggs directory beforehand, though.
>
>Is this a real bug, or are recipes supposed to be so simple as to not need
>extras?
Distributions required by entry points aren't automatically installed; the
code loading the entry point has to pass an 'installer' function to the
loading API in order to support installation-on-demand. Presumably
zc.buildout doesn't do this. An example from setuptools' own code:
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
value = getattr(self,ep.name,None)
if value is not None:
ep.require(installer=self.fetch_build_egg)
ep.load()(self, ep.name, value)
This code loads entry points for any setup() keywords that match the entry
point name, and in the process it will install any extras required by the
entry point.
In setuptools 0.7, I plan to add a feature to make it easier to do this, at
least for pure-Python built eggs found on the CheeseShop. pkg_resources
will have some class or function you'll be able to pass as the 'installer',
and it will use CheesesShop XML-RPC to find and download the eggs to the
PYTHON_EGG_CACHE directory. That way, people who want to support an easy
and (relatively) safe install-on-demand feature can do so without having to
write their own installer package. It won't offer all the
bells-and-whistles of easy_install, but that's actually an advantage for
this use case, methinks.
More information about the Distutils-SIG
mailing list