[lxml-dev] setupinfo.py that downloads/builds libxml2/libxslt

Stefan Behnel stefan_ml at behnel.de
Wed Nov 5 21:32:42 CET 2008


Hi Ian,

Ian Bicking wrote:
> I've attached a version of setupinfo.py that will download and build
> libxml2 and libxslt.  There are some problems with the script, but
> hopefully this is a start.

thanks a lot for doing this. It does not yet build a static lxml for me (the
static stuff was meant for Windows and it doesn't really work on other
systems), but I'm fixing it up to do that.


> If you give the build option --build-libxml2xslt then it will download
> the packages and build them, and set the options to use the xml2-config
> and xslt-config scripts.  I also made it always use --static if you do
> this.

That's definitely the right thing to do. If you use a complete build, it's
best to build statically against your libraries to make sure they are really used.


> do I have to run "make; make install" for those libraries if it is
> a static build, or would ./configure be sufficient?)

"make" is sufficient, no installation required. libxslt even takes a
"--with-libxml-src=DIR" option to build against an uninstalled libxml2.


> Maybe there can also be a fallback to archives distributed directly with lxml?

Yes, that would be great. If they are there, use them, otherwise, do a normal
build.


> The biggest problem is that I'm not sure at all where to put this stuff
> in the setup.py build process.  Right now the options to setup() include
> information about the built versions of these libraries, but simply
> calling "python setup.py" should not cause those libraries to be built.
>  (Right now if you use --build-libxml2xslt it will build those libraries
> at setupinfo/setup.py import time.)  This is the biggest problem I see
> with this at the moment.

I think an option for the download and a check if the library archives lie
around somewhere to trigger the build is best.


> Lastly, I'm having problems building lxml trunk right now, with this error:
> 
>> cythoning src/lxml/lxml.etree.pyx to src/lxml/lxml.etree.c
>>
>> Error converting Pyrex file to C:
>> ------------------------------------------------------------
>> ...
>>     cdef readonly object localname
>>     cdef readonly object namespace
>>     def __init__(self, text_or_uri_or_element, tag=None):
>>         if not _isString(text_or_uri_or_element):
>>             if isinstance(text_or_uri_or_element, _Element):
>>                 text_or_uri_or_element =
>> (<_Element>text_or_uri_or_element).tag
>>                                                   ^
>> ------------------------------------------------------------
>>
>> /home/ianb/src/lxml/src/lxml/lxml.etree.pyx:259:51: Declarator should
>> be empty

Looks like your Cython is somehow broken. It works for me here.

Thanks again,

Stefan



More information about the lxml-dev mailing list