[Distutils] distutils extension commands and option passing
Thomas Heller
theller at python.net
Sat Sep 20 11:32:00 EDT 2003
Stefan Seefeld <seefeld at sympatico.ca> writes:
> hi there,
>
> one of the things I like most about distutils is the compositional
> approach to the build system, i.e. commands such as 'bdist' being
> defined independently of 'build', so as soon as I have a working 'build'
> command, 'bdist' (and its variants) will work out-of-the-box most
> of the time.
>
> However, I'v now run into an issue with this very approach, and I
> wonder how to deal with that:
>
> As the 'build_ext' command shipped with distutils isn't powerful
> enough for my extensions, I'v written one myself. It's basically
> a wrapper around a call to 'make -C ...'. That is accompagnied
> by a 'config' command, doing, what else, a 'configure' call...
>
> I'v added various options to the config command to be able to
> enable/disable the various extensions that can be supported.
>
> But there doesn't seem to be a way to call 'python setup.py bdist_rpm'
> (say) and somehow pass options that are really meant for the config
> command, or is there ?
There are three ways that I know of:
On the command line (undocumented, AFAIK):
python setup.py build_ext <build_ext options> bdist_rpm <bdst_rpm options>
In the setup.cfg file (documented):
[build_ext]
opt_1 = value_1
opt_2 = value_2
[bdist_rpm]
opt_A = value_A
opt_B = value_B
And finally, you can pass a nested dictionary of options to the setup
script (aldo undocumented, AFAIK):
options = {"build_exe": {"opt1": "value1", "opt2": "value2"}
"bdist_rpm": {"opta": "valuea", "optb": "valueb"}}
IMO, patches for the docs would be appreciated.
Thomas
More information about the Distutils-SIG
mailing list