[Distutils] buildout and zc.recipe.egg:custom problems

Jim Fulton jim at zope.com
Sun Dec 3 22:03:45 CET 2006


Jim Fulton wrote:
> Martijn Faassen wrote:
>> Hi there,
>>
>> I'm trying to induce zc.buildout's zc.recipe.egg:custom recipe to build 
>> a library (lxml) against C libraries (libxml2, libxslt) installed in a 
>> custom place, i.e. as parts, such as parts/libxml2/include and 
>> parts/libxml2/lib.
>>
>> I thought I had that working before and even blogged about it, but it 
>> turns out that something's not entirely right yet.
>>
>> Right now I'm struggling to actually see an 'include-dirs' directive to 
>> have any effect on what's passed along to the C-compiler (namely the -I) 
>> option. It doesn't. After some research I think I've figured out why. 
>> I've installed lxml as a development egg, and somehow it always gets 
>> built the default way. The custom egg's install code is reached, but 
>> only when it's too late and lxml is already built. Therefore any special 
>> options such as include-dirs and library-dirs are never passed, as lxml 
>> has already been created.
>>
>> I figure lxml gets created automatically and not through the custom 
>> recipe as I have it listed as a develop egg in the [buildout] section.
>>
>> What to do about this?
> 
> Unfortunately, you've hit a limitation in buildout and the custom recipe.
> This limitation will, eventually, be removed.  When creating develop eggs,
> you have no control over build options.  When creating custom eggs,
> you have no way to use directories as source, and besides, you really want
> a develop egg.
> 
> I think what we want is a develop recipe that lets you specify various
> options when creating develop eggs.  I'll look at writing this over
> the next few days.

I still haven't finished this, but while working on it I realized that
I should have suggested a work around.  You can create a setup.cfg
file in the directory containing your library setup.py file.  This
ConfigParser-style configuration file should have a build_ext section
containing the options you want:

   [build_ext]
   include-dirs = /foo/include

This is actually what the develop recipe will do behind the scenes.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Distutils-SIG mailing list