def get_factory_str(self): """ Returns string representation of factory config that can be included in the buildbot config file """ factory_class, class_path = self.get_factory_class() out = [] f = self._get_factory_name() for step in self.step_set.all(): if step.cast().needs_extra_config: out.append(step.cast().get_extra_config_str()) # create factory class out.append("\n# Build Factory for builder : " + self.name) out.append("%s = %s()" % (f, factory_class)) # add steps to factory for step in self.step_set.all(): out.append("%s.addStep( %s" % (f, get_obj_comment(step))) out.append(" %s" % step.cast().get_config_str()) out.append(")") return "\n".join(out)
def _get_config_block(self, cfg_name, obj_list, require_cast=False): out = [] for obj in obj_list: if require_cast: obj = obj.cast() if obj.needs_extra_config: out.append(obj.get_extra_config_str()) if out: out.append("") # add separator out.append("c['%s'] = [" % (cfg_name)) for obj in obj_list: if require_cast: obj = obj.cast() out.append("\n %s" % get_obj_comment(obj)) out.append(" %s," % (obj.get_config_str(),)) out.append("]") return "\n".join(out)