Commit a50c91ef authored by Vincent Pelletier's avatar Vincent Pelletier

publish: Access "-extends"-referenced sections during __init__

Buildout expects all needed sections to have been accessed during the
sectoin initialisation pass. It does not like having them accessed during
the "install" pass, and emits a very cryptic error:
  While:
    Installing publish.
  Error: Missing option: publish-early:__buildout_signature__
parent db9c68f9
......@@ -31,19 +31,22 @@ from slapos.recipe.librecipe import GenericSlapRecipe
CONNECTION_PARAMETER_STRING = 'connection-'
class Recipe(GenericSlapRecipe):
def _install(self):
publish_dict = {}
done = set()
def __init__(self, buildout, name, options):
super(Recipe, self).__init__(buildout, name, options)
# Tell buildout about the sections we will access during install.
self._extend_set = done = set()
extends = [self.name]
while extends:
name = extends.pop()
done.add(name)
for k, v in self.buildout[name].iteritems():
if k[:1] == '-':
if k == '-extends':
extends += set(v.split()) - done
elif k != 'recipe':
publish_dict[k] = v
name = extends.pop()
done.add(name)
extends += set(self.buildout[name].get('-extends', '').split()) - done
def _install(self):
publish_dict = {}
for name in self._extend_set:
for k, v in self.buildout[name].iteritems():
if k != 'recipe' and not k.startswith('-'):
publish_dict[k] = v
self._setConnectionDict(publish_dict, self.options.get('-slave-reference'))
return []
......
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