Commit 806e6708 authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: CLI buildout:extends not honored

Solution: check value explicitely and open corresponding files
parent 2bf8ee0d
Honor command-line buildout:extends
......@@ -387,6 +387,19 @@ class Buildout(DictMixin):
)
data = _update(data, cfg_data)
# extends from command-line
if 'buildout' in cloptions:
cl_extends = cloptions['buildout'].pop('extends', None)
if cl_extends:
for extends in cl_extends.value.split():
download_options = for_download_options['buildout']
cfg_data, _ = _open(
os.path.dirname(extends),
extends, [], download_options,
override, set(), user_defaults
)
data = _update(data, cfg_data)
# apply command-line options
data = _update(data, cloptions)
......
......@@ -1895,6 +1895,49 @@ There are several things to note about this example:
- Relative file names in extended options are interpreted relative to
the directory containing the referencing configuration file.
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... extends = b1.cfg
...
... [debug]
... op = buildout
... """)
>>> print_(system(buildout + ' buildout:extends="b2.cfg"'), end='')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
op2 b2 2
op3 b2 3
recipe recipes:debug
>>> print_(system(buildout + ' buildout:extends="b2.cfg %(b3)s"'
... % dict(b3=os.path.join(other, 'b3.cfg'))), end='')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
op2 b2 2
op3 b2 3
op4 b3 4
op5 b3base 5
recipe recipes:debug
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... extends = b1.cfg b2.cfg %(b3)s
...
... [debug]
... op = buildout
... """ % dict(b3=os.path.join(other, 'b3.cfg')))
Loading Configuration from URLs
-------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment