[Distutils] Adding a setuptool command that runs when setup.py build is invoked

Ronald Oussoren ronaldoussoren at mac.com
Tue Jan 9 09:51:30 CET 2007


On 6 Jan, 2007, at 2:07, Phillip J. Eby wrote:

> At 04:35 PM 1/5/2007 -0800, Scott Robertson wrote:
>> I'm trying to create a package that provides a setuptool command  
>> that will
>> compile idl files when you run python setup.py build or python  
>> setup.py
>> install.
>>
>> I've figured out how to add an additional command (build_omniidl)  
>> which I
>> can run with:
>>    python setup.py build_omniidl
>>
>> But I'm not sure how to wire it up so that
>>   python setup.py build
>>
>> automatically invokes build_omniidl for me. Basically I want  
>> build_omniidl
>> to act just like build_python.
>>
>>
>> Is this even possible with setuptools?
>
> It's possible even with the distutils.  What you need is to  
> subclass the
> distutils 'build' command class, and then pass your subclass in via  
> the
> 'cmdclass' dictionary argument to setup().
>
> In setuptools 0.7, I plan to allow adding support for these kinds of
> extensions using entry points, so that subclassing isn't needed.

Another alternative is to tweak  
distutils.commands.build.build.sub_commands, which is more convenient  
than subclassing.

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3562 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20070109/124075ea/attachment.bin 


More information about the Distutils-SIG mailing list