[Distutils] Platform specific defaults for config options.
Michel Van den Bergh
vdbergh@luc.ac.be
Thu Jan 4 10:19:01 2001
Rene Liebscher wrote:
> Michel Van den Bergh wrote:
> >
> > Hello,
> >
> > After the extremely useful replies I got to my last question here is
> > another one!
> >
> > Is is possible to set defaults for command line options in setup.py?
> >
> > I would like to put in some PLATFORM-SPECIFIC defaults. E.g, choice
> > of compiler, installation directory.
> >
> > The limited format of config.cfg does not seem to allow this.
> >
> You probably have to overwrite the Distribution class.
> (you can find it in distutils/dist.py)
>
> You could set your options right in self.__init__() or so,
> see also self.command_options
> and self.parse_config_files().
>
> See also
> http://mail.python.org/pipermail/distutils-sig/1999-January/000143.html
> You have write then your setup like this:
> ------------------------------------------------------------------------
> from distutils.core import Distribution, setup
>
> class MyDistribution (Distribution):
> def __init__(self):
> Distribution.__init__(self)
> # put your initialization here
>
> setup (distclass = MyDistribution)
> ------------------------------------------------------------------------
>
> BTW, I have never extended the Distribution class, so I can't
> guarantee it is correct.
>
> Kind regards
> Rene Liebscher
Thanks,
Using your idea I could inspect the mechanics of distutils a little better.
Then I found out that setup has an option
'options' (undocumented as far as I can tell) which allows you to give
default values for options. So it is actually pretty easy.
It think it would be better to have config files of the form :
setup_osname. This would be more transparent.
Regards,
Michel