[Python-Dev] Integrate BeautifulSoup into stdlib?

David Cournapeau cournape at gmail.com
Thu Mar 26 06:24:59 CET 2009


On Thu, Mar 26, 2009 at 2:01 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> On Thu, Mar 26, 2009 at 5:32 AM, David Cournapeau <cournape at gmail.com> wrote:
>> If distutils was split into different modules (one for the build, one
>> for the compiler/platform configuration, one for the installation),
>> which could be extended, tweaked, it would be much better. But the
>> distutils design makes this inherently very difficult (commands).
>
> I am not sur why the command design is a problem here.

For several reasons:
 - options handling cannot be done correctly. If you need to pass some
options specific to the build, you have to pass it to build_clib and
build_ext, etc... Example: I would really like to add options like
--with-libfoo ala autoconf so that the packager can simply say where
to look for a library (headers, .so, etc....). This cannot be done
easily in distutils (no persistence, no easy way to communicate
between commands)
 - the whole concept of commands is bogus for a build tool. The
correct way to do builds is with a DAG, to handle dependencies.

> And I think
> Distutils features are not far from
> what you need, if you look at things like customize_compiler, which is
> called by build_clib.

The whole customize_compiler is awful. You cannot call it when you
want, but only at some arbitrary time in the execution, which is not
documented. You have to create your own command, because you can't
call it in setup.py directly. You may have to call
initialize_something_which_has_nothing_to_do_with_compiler(), which
may break on windows because the MS compiler abstraction is totally
different than the unix one.

It is actually hard to believe if you never had to deal with it: so
many trivial things which are one line of code in every other tool are
difficult, obscure, magic or damn impossible in distutils. Modifiying
compiler flag ? You have to create a new compiler class. Installing
docs ? You have to create your own install class. etc...

>
> I'm ready to discuss your use case in Distutils-SIG, if you have a
> complete example etc.

Ok, I will give you the example on the distutils ML,

David


More information about the Python-Dev mailing list