python-ldap as egg with buildout

erstellt von Jens W. Klein — 08.07.2008 16:20

Installing python-ldap as an python egg from python package index inside zc.buildout without the matching openldap version on the system.

For one customer project (e-learning, communication and process management platform for a large school in switzerland) and for the new plone.org I had to integrate python-ldap in my buildout. Its targeting a Debian Etch Linux. On my Ubuntu Gutsy dev-box it had to work as well and - to make plone.org developers happy - OSX needs to be supported as well.

The python-ldap library compiles itself on installation time. easy_install did this fine as long the dependend C-libraries are somewehre in the usal system-paths. It requires libsasl, libdb, libssl and libldap2. First three headers are in etch's dev-packages of the libraries:

apt-get install libdb4.4-dev libsasl2-dev libssl-dev

libdap2-dev is available, but in an older version (2.1) while 2.3 is needed. Etch has an libldap2.3-0 available, but without any -dev package.

With buildout and zc.recipe.cmmi I were able to compile OpenLDAP as buildout part:

[openldap]
recipe = zc.recipe.cmmi
url = ftp://gd.tuwien.ac.at/infosys/network/OpenLDAP/openldap-stable/openldap-stable-20071118.tgz
extra_options = --with-sasl --with-tls --enable-slapd=no

 Now I just built the egg as custom egg using zc.recipe.egg:

[python-ldap]
recipe = zc.recipe.egg:custom
egg = python-ldap
include-dirs  = 
	${openldap:location}/include
library-dirs  = 
	${openldap:location}/lib
rpath = 
	${openldap:location}/lib

Pretty simple, right? ;-) Now just call the parts in your buildout, and put ${python-ldap:egg} to your zope instances eggs section.

 

Artikelaktionen