[Distutils] Static metadata using setup.cfg
Tarek Ziadé
ziade.tarek at gmail.com
Wed Sep 9 09:32:53 CEST 2009
On Wed, Sep 9, 2009 at 1:31 AM, Greg Ewing<greg.ewing at canterbury.ac.nz> wrote:
> Tarek Ziadé wrote:
>
>> In that case, if we want to keep a configparser-compatible file, we
>> need to find another
>> way to express these if/else parts, which will probably lead to a
>> complex, non natural
>> syntax.
>
> Maybe the conditions could be expressed in the
> section headers?
>
> [requires platform="linux"]
> ...
>
> [requires platform="win32"]:
> ...
>
> Then it's not so much if-then-else logic as just
> tagging parts of the file with conditions under
> which they apply.
The problem is that we need more complex conditions like:
"platform == linux and python >= 2.5"
in that case, the ConfigParser format is making it hard to do it
like you've described, unless the section is the full expression :
[requires platform="linux" and python >="2.5"]
Notice that this *does* work with ConfigParser but you can't express
'else' conditions easily. But this is not a great deal, I can accomodate not
having elses.
Maybe the expression can be located in a specific variable for readability:
"""
[setup]
name = foo
conditional-sections = one, two
[one]
condition: platform="linux" and python >= "2.5"
require: lxml
[two]
condition: platform="win32" and python >= "2.5"
require: docutils
"""
This would be more powerfull since each section could define any metadata,
under some conditions.
I would be ok with that shape, even if I do find this more readable:
"""
[setup]
name = foo
{$ if platform="linux" and python >= "2.5": $}
require: lxml
{$ :endif $}
{$ platform="win32" and python >= "2.5": $)
require: docutils
{$ :endif $}
"""
In any case, the restrictions to what variables the expressions can
work with would stay the same.
>
> --
> Greg
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig
>
--
Tarek Ziadé | http://ziade.org | オープンソースの岩!
More information about the Distutils-SIG
mailing list