[Distutils] setup.cfg new format proposal

Tarek Ziadé ziade.tarek at gmail.com
Tue Sep 15 11:00:41 CEST 2009


On Tue, Sep 15, 2009 at 10:47 AM, Greg Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Tarek Ziadé wrote:
>
>> I find having a conditional section explicitely defined better that
>> doing a convention on names because if someone implements
>> a command that uses that name (it's likely to be improbable but...)
>> it will break his ability to use setup.cfg to give options to his commands
>
> I don't follow that. If a "conditions:" line is being
> used to express the condition, then you can't use the
> name "conditions" for anything else anyway.

setupt.cfg is also used by commands that is.

Imagine a command with the name "foo", that has an option called "condition".

The setup.cfg file might look like this:

"""
[global]
verbose: 1

[setup]
name: MyDistribution
version: 1.0

[only_windows]
condition: sys_platform == 'win32'
requires: pywin32

[foo]
verbose: 1
condition: badababdalolo
""""

Here, the foo section is not supposed to be used by the setup section,
it's just a section for the command value, which is allowed (see
http://docs.python.org/distutils/configfile.html)

Now Distutils, if told to grab all sections that have a "condition"
variable in them, will fail at reading "badababdalolo".

With an explicit list of the conditional sections, the probelm can't
occur, because it's explicit:

"""
[global]
verbose: 1

[setup]
name: MyDistribution
version: 1.0

conditional-sections: only_windows

[only_windows]
condition: sys_platform == 'win32'
requires: pywin32

[foo]
verbose: 1
condition: badababdalolo
""""

Tarek
-- 
Tarek Ziadé | http://ziade.org | オープンソースはすごい!


More information about the Distutils-SIG mailing list