def extends(self, options, seen): extends = [e.strip() for e in options.get('extends','').split() if e.strip()] for extension in extends: if extension in seen: continue seen.append(extension) part = self.buildout.get(extension) if part is None: # try interpreting extends as recipe eopts = {} # eopts.update(options) eopts['recipe'] = extension #buildout._raw[extension] = eopts #dodgy hack since buildout.__setitem__ not implemented #part = buildout.get(extension) #part = Options(buildout, name, eopts) #part._initialize() reqs, entry = _recipe(eopts) recipe_class = _install_and_load(reqs, 'zc.buildout', entry, self.buildout) recipe = recipe_class(self.buildout, self.name, self.options) self.subrecipes.append(recipe) egg = extension.split(':')[0] self.options['eggs'] = '\n'.join(self.options.get('eggs','').split() + [egg]) continue else: self.extends(part, seen) for key in part: if key in ['fabfiles', 'pre-commands', 'post-commands']: fabfiles = part[key].split() self.options[key] = '\n'.join(self.options.get(key, '').split()+fabfiles) elif key not in self.options.keys(): self.options[key] = part[key] return seen
def _initialize(self, *args, **kwargs): """On intialization, install our recipe instead""" Options._old_initialize(self, *args, **kwargs) recipe = self.get("recipe") if not recipe: return name = self.name reqs, entry = _recipe(self._data) mappings = { ("zc.recipe.egg", "default"): ("minitage.recipe.scripts", "default"), ("zc.recipe.egg", "script"): ("minitage.recipe.scripts", "default"), ("zc.recipe.egg", "scripts"): ("minitage.recipe.scripts", "default"), ("zc.recipe.egg", "Custom"): ("minitage.recipe.scripts", "default"), ("zc.recipe.egg", "Eggs"): ("minitage.recipe.egg", "default"), ("zc.recipe.egg", "eggs"): ("minitage.recipe.egg", "default"), ("zc.recipe.cmmi", "default"): ("minitage.recipe.cmmi", "default"), } reqsa, entrya = mappings.get((reqs, entry), (None, None)) if reqsa: recipe_class = _install_and_load(reqsa, "zc.buildout", entrya, self.buildout) self.recipe = recipe_class(buildout, name, self) self.recipe.logger.info("Replaced %s with %s" % ((reqs, entry), (reqsa, entrya)))
def _initialize(self, *args, **kwargs): """On intialization, install our recipe instead""" Options._old_initialize(self, *args, **kwargs) recipe = self.get('recipe') if not recipe: return name = self.name reqs, entry = _recipe(self._data) mappings = { ('zc.recipe.egg', 'default'): ('minitage.recipe.scripts', 'default'), ('zc.recipe.egg', 'script'): ('minitage.recipe.scripts', 'default'), ('zc.recipe.egg', 'scripts'): ('minitage.recipe.scripts', 'default'), ('zc.recipe.egg', 'Custom'): ('minitage.recipe.scripts', 'default'), ('zc.recipe.egg', 'Eggs'): ('minitage.recipe.egg', 'default'), ('zc.recipe.egg', 'eggs'): ('minitage.recipe.egg', 'default'), ('zc.recipe.cmmi', 'default'): ('minitage.recipe.cmmi', 'default'), } reqsa, entrya = mappings.get((reqs, entry), (None, None)) if reqsa: recipe_class = _install_and_load(reqsa, 'zc.buildout', entrya, self.buildout) self.recipe = recipe_class(buildout, name, self) self.recipe.logger.info( "Replaced %s with %s" % ((reqs, entry), (reqsa, entrya)) )