[lxml-dev] lxml setup.py exslt link flag

Luke Tucker ltucker at openplans.org
Wed Nov 15 17:37:59 CET 2006


Hey, 

I came across a slight issue with the part of lxml's setup.py
that adds a link flag for exslt when libxslt is installed 
in a directory with a name containing the string 'xslt'. 

not a huge deal, and probably a somewhat odd case, but I 
thought I'd mention it.

If I understand correctly, to generate the link flag for 
libexslt, the result of 'xslt-config --libs' 
is taken and searched for an element containing 'xslt' and 
a new element is inserted which has 'exslt' instead. 

setup.py:117: 
=================================================
    xslt_libs = flags('xslt-config --libs')
    # compile also against libexslt!
    for i, libname in enumerate(xslt_libs):
        if 'exslt' in libname:
            break
        if 'xslt' in libname:
            xslt_libs.insert(i, libname.replace('xslt', 'exslt'))
            break
==================================================

In my case, I was working with an install of libxslt in: 

/home/ltucker/devel/deliverance.buildout/parts/libxslt

and 'xslt-config --libs' returns: 

---------------------------------------------------------------------
-L/home/ltucker/devel/deliverance.buildout/parts/libxslt/lib
-L/home/ltucker/devel/deliverance.buildout/parts/libxml2/lib -lxslt
-lxml2 -lz -lm
---------------------------------------------------------------------

in this case, the snippet above produces a list like

---------------------------------------------------------------------
-L/home/ltucker/devel/deliverance.buildout/parts/libexslt/lib
-L/home/ltucker/devel/deliverance.buildout/parts/libxslt/lib
-L/home/ltucker/devel/deliverance.buildout/parts/libxml2/lib -lxslt
-lxml2 -lz -lm
---------------------------------------------------------------------

(adding a -L line rather than a -l) 

The final result was an etree.so that mysteriously didn't have a
dependency on libexslt and produced run-time link errors. 

I believe this problem would apply to the lxml buildout as well, 
but it doesn't call the parts/libxslt/bin/xslt-config. (Do 
questions about the lxml buildout go to this list?)

As a related side note, it might be nice to have the setup.py 
complain if 'xslt-config' can't be found.  If it isn't around, 
it appears to silently create an etree.so with no dependencies 
on libxml2/xslt/exslt. 

- Luke 



More information about the lxml-dev mailing list