[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:

recipe = zc.recipe.deployment:configuration
text =
  use = egg:bobo
  bobo_resources = cmsapp
  filter-with = zodb

  use = egg:zc.zodbwsgi
  configuration =
    <zodb main>
          server ${main-db-server:address}
    <zodb index>
          server ${index-db-server:address}

  use = egg:Paste#http
  host = localhost
  port = 8080

Don't work because leading whitespace is stripped, forcing me to use
hacks like this::

recipe = zc.recipe.deployment:configuration
s =
text =
  ${:s}use = egg:bobo
  ${:s}bobo_resources = cmsapp
  ${:s}filter-with = 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}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 Fulton

More information about the Distutils-SIG mailing list