RE: [Distutils] Distutils enhancement - set variables from the co mmand line
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. 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') The user can then either run python setup.py build or python setup.py build JPEG_LOCN=C:\LocalLibs\JPEG depending on his setup. Paul.
"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/
On Tue, 17 Jul 2001 18:02:37 +0200, M.-A. Lemburg wrote:
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. [...] 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) ?
... because I didn't know you could do that. That's excellent - it simply never occurred to me that something like that would be possible, let alone easy. I am still thinking in makefile terms (or at best, in Perl MakeMaker terms), where this sort of thing is annoyingly difficult, if it's even possible. It's this sort of flexibility that makes Python *so* nice to use. It's just a pity that there isn't enough of this type of feature documented for distutils. Thanks for pointing this out to me. I'll go and have a look at the mx setup files, for further enlightenment... Paul.
participants (3)
-
M.-A. Lemburg
-
Moore, Paul
-
Paul Moore