[Distutils] Extending distutils with 3rd party build commands?

Bob Ippolito bob at redivi.com
Thu Oct 21 01:42:05 CEST 2004


On Oct 20, 2004, at 19:09, M.-A. Lemburg wrote:

> Bob Ippolito wrote:
>> On Oct 20, 2004, at 18:38, Bob Ippolito wrote:
>>> On Oct 20, 2004, at 18:10, M.-A. Lemburg wrote:
>>>
>>>> Bob Ippolito wrote:
>>>>
>>>>> I've developed two bdist commands (bdist_pkg and bdist_mpkg) for 
>>>>> usage on OS X.  These commands apply to any setup.py that supports 
>>>>> an "install" command, similar to bdist_wininst, so it would be 
>>>>> nice if every setup.py didn't have to explicitly import something 
>>>>> in order to get the commands there.
>>>>> I know I can make it work with a pth file that imports bdist_pkg, 
>>>>> but that seems a bit costly to do because it will end up importing 
>>>>> a bunch of stuff (distutils, mainly).
>>>>> Is there another way to do it?
>>>>
>>>>
>>>> Submit them for inclusion in the standard distribution ;-)
>>>
>>>
>>> I will, for 2.5... but there's quite some time between now and then.
>> Well I did find another way, thanks to PEP 302.
>> How "evil" would it be if I had this module imported by a pth file?  
>> It does do what I want it to do, but I'm not sure if it's safe to 
>> inflict on users or not..
>
> Import hooks are bad. Avoid them if you can.
>
> What so bad in adding a sinlge import to all your setup.pys ?
> That import could then trigger the installation of the new
> command by importing distutils and tweaking the cmdclass
> in distutils, e.g.
>
> import biDistutilsExtensions

Because I want to recommend that people use bdist_mpkg to install 
arbitrary python packages similar to the way that bdist_wininst is 
used.  Yes, I know import hooks are bad, but I don't want people to 
have to go around modifying every setup.py they see.

-bob



More information about the Distutils-SIG mailing list