propagating distutil user options between commands

gatti at dsdata.it gatti at dsdata.it
Mon Oct 10 05:17:02 EDT 2005


When building a C extension, Distutils standard command 'install' calls
the 'build' command before performing the installation (see
Lib/distutils/command/install.py and build.py).
Reusing the build command is the correct way to ensure the installation
payload is ready, but the two commands support very different sets of
user options and it is impossible to combine them: install validates
them at the beginning, rejecting user options meant for build as
"unrecognized".
This becomes a problem with necessary build options like --compiler;
there is an easy workaround for my specific case (running setup.py
twice: "build --compiler=..." then "install --skip-build"), but
--skip-build is an ad hoc option, other combinations of commands and
options can have the same problem.
There are systematic solutions, like letting every option propagate to
subcommands without checking, on the assumption that unrecognized
options do no harm, or labeling options by command (e.g. setup.py
install --build:compiler=foo --install_scripts:force) to let every
command validate its options only and limit options to specific
commands as a byproduct.
What are the reasons for the current strict policy in Distutils? Can it
be changed?

Lorenzo Gatti




More information about the Python-list mailing list