pythonbuildout

Does Buildout support value substitution in the extends option?


Does Buildout support value substitution in the extends option of the buildout section?

For example, this example.cfg doesn't extend with base.cfg:

[config]
base = base.cfg

[buildout]
extends =
    ${config:base}
parts =

buildout -c example.cfg annotate

My goal is to send the file-to-extend as a parameter from the outside like this:

buildout config:base=base.cfg -c example.cfg annotate

I tried to merge the buildout:extends from the outside; but that doesn't work either:

buildout buildout:extends+=base.cfg -c example.cfg annotate

Solution

  • No, extends doesn't support value substitutions, unfortunately. The current implementation processes buildout.extends before variable substitution can take place.

    There is an existing feature request open for this: #39 No variable substitutions in extends.

    I generally create a local.cfg file first, perhaps from a template, and run buildout -c local.cfg. That'd be the kind of place I'd put custom extends configuration.