[Distutils] Proposed change to buildout configuration-file handling
Jim Fulton
jim at zope.com
Sun Mar 6 16:34:01 CET 2011
An annoyance in buildout configurations, resulting from it's use of
ConfigParser, is that configuration data lines are stripped of leading
spaces. This means configurations like this:
[paste.ini]
recipe = zc.recipe.deployment:configuration
text =
[app:main]
use = egg:bobo
bobo_resources = cmsapp
filter-with = zodb
[filter:zodb]
use = egg:zc.zodbwsgi
configuration =
<zodb main>
<zeoclient>
server ${main-db-server:address}
</zeoclient>
</zodb>
<zodb index>
<zeoclient>
server ${index-db-server:address}
</zeoclient>
</zodb>
[server:main]
use = egg:Paste#http
host = localhost
port = 8080
Don't work because leading whitespace is stripped, forcing me to use
hacks like this::
[paste.ini]
recipe = zc.recipe.deployment:configuration
s =
text =
${:s}[app:main]
${:s}use = egg:bobo
${:s}bobo_resources = cmsapp
${:s}filter-with = zodb
${:s}
${:s}[filter:zodb]
${:s}use = egg:zc.zodbwsgi
${:s}configuration =
${:s} <zodb main>
${:s} <zeoclient>
${:s} server ${main-db-server:address}
${:s} </zeoclient>
${:s} </zodb>
${:s} <zodb index>
${:s} <zeoclient>
${:s} server ${index-db-server:address}
${:s} </zeoclient>
${:s} </zodb>
${:s}
${:s}[server:main]
${:s}use = egg:Paste#http
${:s}host = localhost
${:s}port = 8080
:(
I propose to give buildout it's own parser that begaves like
ConfigParser, with the exeption that leading whitespace won't be
stripped, but will be dedented with textwrap.dedent.
There is some potential for breakage as some option values without
leading whitespace before would get it now, but my sense is that this
would be unlikely.
Thoughts? If I did that (and I really want to do this) I'd release a
beta to help people assess the impact.
Jim
--
Jim Fulton
http://www.linkedin.com/in/jimfulton
More information about the Distutils-SIG
mailing list