[Distutils] Distutils enhancement - set variables from the command line

M.-A. Lemburg mal@lemburg.com
Tue Jul 17 12:41:01 2001

"Moore, Paul" wrote:
> >From: M.-A. Lemburg [mailto:mal@lemburg.com]
> > Paul Moore wrote:
> >> My suggestion would be to allow the "global_opts" or "cmdX_opts" to
> contain
> >> arguments of the form key=value. These can be exposed to setup.py as a
> >> dictionary, say distutils.args.
> >>
> >> What do people think?
> >
> > Doesn't setup.cfg provide enough means for the user to customize the
> > distutils behaviour ?
> Not really. As far as I can see from the documentation, it allows the user
> to set existing command line options. It doesn't allow the user to supply
> arbitrary configuration information.

There's no such thing as "arbitrary configuration information" ;-)

Configuration parameters always have to be written down in some
setup.py file and making them additionally available as options is 
really easy with distutils.
> The example I hit this with was installing a module which depended on the
> JPEG library. On Windows, there is no "standard" location where such a
> library would be installed. It is not unlikely, however, that the user might
> have built the library just to install this extension - so a reasonable
> default might be ..\jpeg-6b. So I envision setup.py having something like:
>     JPEG_LOCN = distutils.args.get('JPEG_LOCN', '../jpeg-6b')

Why not simply add an --jpeg=<location> option to the build command
by subclassing the standard one in distutils (I do that a lot in the
eGenix mx stuff and it works just fine -- distutils is wonderful
at this; I wish it would use that paradigm more often, e.g. for
compiler classes as well) ?
> The user can then either run
>     python setup.py build
> or
>     python setup.py build JPEG_LOCN=C:\LocalLibs\JPEG
> depending on his setup.

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/