Fred L. Drake, Jr. wrote:
I'd like it to be possible to add additional commands to distutils with modifying distutils itself or the setup.py file included with packages. I don't think this needs to be a particularly risky change.
The use case is to allow additional commands to be added for all distutils setup.py scripts, or to replace commands with site-specific. This could then be used to support alternate bdist_* flavors (either for additional types of packages or alternate implementations for currently supported package types). It could also be used to provide alternate implementations of existing commands to support alternate policies.
Specifically, I propose that distutils should be extended to search for an implementation class across a list of packages instead of only distutils.command, keeping distutils.command as the default entry in the list. Additional packages could be identified using a command line option or configuration data.
I'm willing to work up a patch for this; are there any objections to adding this functionality in Python 2.4? (I'd like to have this in the coming alpha if at all possible.)
I'm +1 on being able to *add* new commands this way, but a strong -1 on overriding distutils own commands by doing import hackery. The reason for the latter is that tracking down errors in such setups is a complete nightmare - both for the developer and the user.
How about something like a PYTHONDISTUTILSPATH + distutils.path (mimicing PYTHONPATH and sys.path for command lookups) ?