Installing python-ldap in OpenSolaris 2009.06
By Jeff Trawick on Apr 05, 2009
Note: This has been tested with b110, which is very close to the final 2009.06 GA build.
One of the new features in OpenSolaris 2009.06 is the integration of OpenLDAP 2.4.11. The presence of the client libraries in particular will be of great benefit to the deployment of a number of open source applications which have extensive support for the OpenLDAP libraries but not so much (or any) for the native Solaris LDAP libraries.
One such application is the LDAP extension for Python. As noted in its INSTALL file:
- Python 2.3 or newer (see http://www.python.org)
- OpenLDAP libs (see http://www.openldap.org)
You need OpenLDAP 2.3.x client libs or newer for full
functionality. It is not possible and not supported
by the python-ldap project to build with prior versions.
Some open source applications have challenges with the OpenLDAP file layout in OpenSolaris; however, python-ldap isn't one of them, as the setup.cfg mechanism is flexible enough to support the names of the OpenLDAP libraries and the locations of the OpenLDAP header files within OpenSolaris.
Here are the required changes to the default setup.cfg from python-ldap 2.3.6 to build with OpenSolaris 2009.06:
$ diff -u setup.cfg.orig setup.cfg
--- setup.cfg.orig Mon Apr 6 07:42:07 2009
+++ setup.cfg Mon Apr 6 07:44:27 2009
@@ -1,9 +1,9 @@
-libs = ldap_r lber sasl2 ssl crypto
-library_dirs = /usr/local/openldap-2.3/lib
-include_dirs = /usr/local/openldap-2.3/include /usr/include/sasl
+libs = ldap_r-2.4 lber-2.4 sasl ssl crypto
+library_dirs = /usr/sfw/lib
+include_dirs = /usr/include/openldap /usr/include/sasl
With these changes, you can proceed to the usual python setup.py build and python setup.py install, but first note that three levels of Python are included with 2009.06 -- 2.4, 2.5, and 2.6 -- with the default python command pointing to 2.4. You'll need to install python-ldap for the desired version(s) of Python. For example, to install it for use with the non-default Python 2.6, use the commands python2.6 setup.py build and python2.6 setup.py install.