[Distutils] setup.cfg new format proposal

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Sep 11 16:47:11 CEST 2009

On 02:33 pm, ziade.tarek at gmail.com wrote:
>here's a detailed proposal for the setup.cfg format. I've included all 
>and tried to make the syntax as simple as possible. I've dropped the
>stuff and the template language stuff. (people can do it as a
>post-release process)
>A/ Config file structure:
>foo: bar
>conditional-sections: one, two
>condition: test
>condition: test

The idea here is that the [setup] section includes everything in section 
[one] if all of the "condition" clauses in [one] are satisfied, and 
includes everything in section [two] if all of the "condition" clauses 
in [two] are satisfied?
>2/ Execution environment:
>  python_version = '%s.%s' % (sys.version_info[0], sys.version_info[1])
>  os_name = os.name
>  platform = sys.platform
>  uname = os.uname()
>  python_version_info = sys.version_info
>3/ Grammar:
>comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 
>comparison: expr (comp_op expr)*
>test: or_test
>or_test: and_test ('or' and_test)*
>and_test: not_test ('and' not_test)*
>not_test: 'not' not_test | comparison

What's "STRING"?  What's the precedence of and, or, and not?  What does 
this mean?

    os_name > uname > 7

What does "is" mean?

Is this all really Python, with lots of features thrown out?
>4/ Process
>distutils will interpret [setup] and act upon, to fill the
>Distribution object and its metadata attribute object.
>It will look only for Metadata fields and ignores the others.
>In case an option is passed in setup.py, it overrides the one in 
>Let me know if it's good enough. I won't write a PEP for this change,
>and I will just push it for information at python-dev as soon as I get
>enough +1 :)

I'm a little skeptical about creating a new mini language (particularly 
one with branching) for setup.cfg, but I haven't really been paying 
close attention to this discussion.  Still, it might be good to give a 
brief summary of the justification for this someplace.  Maybe you were 
already planning to do that.


More information about the Distutils-SIG mailing list