[Distutils] Fwd: distutil command lines
Brandon Long
blong at fiction.net
Mon Aug 4 00:47:33 EDT 2003
I mailed this to Greg, and he said to try here:
I've got a project with a python wrapper/extension module (amoung
others), called ClearSilver http://www.clearsilver.net/
The package uses autoconf/configure to determine which programs are
available, and how to build things, etc. This includes external
libaries and locations for them, like -lz, -ldb, etc.
Until recently, I've been just providing a Makefile for compiling the
python extension, instead of using distutils. I don't really want to
deal with compiling the shared library on all of the platforms, though,
so I figured I'd go and create the setup.py script.
The trouble is, how to pass the information from configure to the
setup.py. I was just going to pass them on the command line, ie from
Makefile:
$(PYTHON) setup.py ext_build $(INCLUDES) $(LIBDIRS) $(LIBS)
where $(INCLUDES) is a list of -Ipaths and $(LIBDIRS) is a list of
-Lpaths and $(LIBS) is a list of -llibraries.
Unfortunately, the command-line processing code, and the code for the
setup.cfg file, seems to take the command line arguments and put them
into a dictionary. Later, that dictionary is used to set the attributes
of the ext_build class, which then translates the string into a single
item list.
So, this means I can't specify more than one option on the command line
and get a list of libraries or paths. In fact, there seems to be no way
to set a list on an option via the command line. That seems bad. Most
people seem to deal with this problem by having as much smarts in the
setup.py file as there are in their configure script... which seems
annoying, especially since if there are similar macros for finding
libraries and the like in distutils, they are at least not documented.
Its also not clear to me how I can parse the command line arguments in
setup.py... though I guess I could probably just import sys, run through
sys.argv removing my arguments, or some such. I didn't try that,
though. Instead, my "solution" is to parse the Makefile from the
setup.py file, and setup the options from what I get. Obviously I can't
write all of make, but it works well enough for my task (its not up
there yet, it'll be in the next version).
Any thoughts on fixing the command line arguments to support list
options?
Brandon
--
program, n.:
A magic spell cast over a computer allowing it to turn one's input
into error messages. tr.v. To engage in a pastime similar to banging
one's head against a wall, but with fewer opportunities for reward.
http://www.fiction.net/blong/
More information about the Distutils-SIG
mailing list