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

Bob Ippolito bob at redivi.com
Thu Oct 21 14:50:27 CEST 2004


On Oct 21, 2004, at 3:51, M.-A. Lemburg wrote:

> Bob Ippolito wrote:
>> On Oct 20, 2004, at 19:09, M.-A. Lemburg wrote:
>>> 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.
>
> I was talking about the packager, not the user who wants to install
> a package (s/he would use the output of bdist_mpkg, not the
> setup.py).

Well, I want users to be packagers as well.  Not every Python module is 
going to have a prebuilt .mpkg lying around, and using bdist_mpkg to 
install modules has its advantages over a normal setup.py install.  The 
three big ones are: it goes into the installation database so you can 
remove it, you can choose what you don't want to install, and it puts 
scripts in a reasonable place (sys.prefix for a typical 
--enable-framework Python points inside a framework, so "bin" lives far 
away from PATH, when /usr/local/bin is almost always preferable).

> I also assume that there will have to be other modifications
> to the code to make it compatible to bdist_mpkg - just like you
> have to provide extra options to make bdist_wininst and bdist_rpm
> do what you like.

Nope, it does the right thing by default, no options are necessary.  
Unless you want to add stuff like examples, documentation, etc. that 
the 'install' command wouldn't provide for you.  It will automatically 
pick up any readme or license it finds and insert that into the 
installer, if not it will use long_description for the readme.

-bob



More information about the Distutils-SIG mailing list