Commit d853d17d authored by Jim Fulton's avatar Jim Fulton

Merge pull request #37 from kilink/master

Fix macro inheritance bug
parents ab708739 8678876e
...@@ -1117,7 +1117,7 @@ class Options(DictMixin): ...@@ -1117,7 +1117,7 @@ class Options(DictMixin):
raise zc.buildout.UserError("Infinite extending loop %r" % name) raise zc.buildout.UserError("Infinite extending loop %r" % name)
doing.append(name) doing.append(name)
try: try:
to_do = data.pop('<', None) to_do = data.get('<', None)
if to_do is None: if to_do is None:
return data return data
__doing__ = 'Loading input sections for %r', name __doing__ = 'Loading input sections for %r', name
...@@ -1133,6 +1133,7 @@ class Options(DictMixin): ...@@ -1133,6 +1133,7 @@ class Options(DictMixin):
result.update(self._do_extend_raw(iname, raw, doing)) result.update(self._do_extend_raw(iname, raw, doing))
result.update(data) result.update(data)
result.pop('<', None)
return result return result
finally: finally:
assert doing.pop() == name assert doing.pop() == name
......
...@@ -1074,7 +1074,7 @@ Extending sections (macros) ...@@ -1074,7 +1074,7 @@ Extending sections (macros)
A section (other than the buildout section) can extend one or more A section (other than the buildout section) can extend one or more
other sections using the ``<`` option. Options from the referenced other sections using the ``<`` option. Options from the referenced
sections are copied to the refering section *before* variable sections are copied to the referring section *before* variable
substitution. This, together with the ability to refer to variables substitution. This, together with the ability to refer to variables
of the current section allows sections to be used as macros. of the current section allows sections to be used as macros.
......
...@@ -2718,6 +2718,40 @@ def want_new_zcrecipeegg(): ...@@ -2718,6 +2718,40 @@ def want_new_zcrecipeegg():
Error: Bad constraint >=2.0.0a3 zc.recipe.egg<2dev Error: Bad constraint >=2.0.0a3 zc.recipe.egg<2dev
""" """
def macro_inheritance_bug():
"""
There was a bug preventing a section from using another section as a macro
if that section was extended with macros, and both sections were listed as
parts (phew!). The following contrived example demonstrates that this
now works.
>>> write('buildout.cfg',
... '''
... [buildout]
... parts = foo bar
... [base]
... recipe = zc.recipe.egg
... [foo]
... <=base
... eggs = zc.buildout
... interpreter = python
... [bar]
... <=foo
... interpreter = py
... ''')
>>> print_(system(join('bin', 'buildout')), end='') # doctest: +ELLIPSIS
Installing foo.
...
Installing bar.
...
>>> ls("./bin")
- buildout
- py
- python
"""
###################################################################### ######################################################################
......
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