[lxml-dev] changes to lxml's setup.py

Martijn Faassen faassen at infrae.com
Wed Nov 22 15:27:35 CET 2006


Hi there,

I've just checked in a change to lxml that refactors lxml's setup.py to 
be more hackable.

No functionality should've changed, though I'd like people to test the 
static build option on Windows. The way to set the static paths is 
somewhat easier now; see the static build section in doc/build.txt for 
more information.

Basically I've split up a lot of stuff that'd grown into setup.py into 
separate modules and made everything a function instead of top-level 
code. This should make the code easier to follow and adjust in the 
future. Basically two new modules have been added:

* versioninfo.py gets all kinds of version numbers and last change 
information

* setupinfo.py prepares the building of Pyrex/C extensions.

I've also made everything depend in a hard way on setuptools being 
available on the system - I think supporting old-style distutils is just 
going to be too much of a distraction to maintain properly.

Next I'm investigating what to do with the --rpath option. I believe 
that currently --rpath is treated rather strangely by lxml's setup.py.

--rpath normally expects a list of directory paths pointing to the 
libraries to link with. This is quite useful if you're linking against 
libraries in non-standard locations, such as in a buildout. It allows 
you to create a module that just works without having to set things like 
LD_LIBRARY_PATH before you try importing it.

In case of lxml however, --rpath is ripped out of the list of options 
that reaches distutils/setuptools and action is taken by manipulating 
the other configuration parameters instead. This works so I haven't 
changed it (I hope), but it doesn't do enough. I *think* by adding an 
option --xslt-config pointing to a custom location for xslt-config we 
can make things work, though that would be hard to support in a straight 
buildout, as buildout obviously has no knowledge about passing such 
options. Food for more thought.

Regards,

Martijn



More information about the lxml-dev mailing list