Ejemplo n.º 1
0
    def load_generator(self, start_dir=None):
        loader = Loader()
        old_loader = set_loader(loader)

        try:
            g_info = get_generator_info(self.frame, self)
            if not g_info:
                return
            is_remote, name, package_dir, repo_uri, generator_id, ver = g_info

            if is_remote:
                rc = RecipeConfig()
                rc.generator = (generator_id, repo_uri, generator_id, ver)

            else:
                _class = get_class(package_dir, generator_id)

                if RecipeBasedGenerator in _class.__bases__:
                    rc = _class.get_recipe_config()

                else:
                    rc = RecipeConfig()
                    rc.generator = (generator_id, package_dir, generator_id)

            doc = self.add_document(rc, loader)

        finally:
            set_loader(old_loader)

        self.run_document(doc)
Ejemplo n.º 2
0
    def _get_class(self, location, _id, version=None):
        old_loader = set_loader(self.loader)

        try:
            _class = get_class(location, _id, version)
        finally:
            set_loader(old_loader)

        return _class
Ejemplo n.º 3
0
    def _update_recipe(self, loader=None):
        loader = loader or self.loader

        old_loader = set_loader(self.loader)

        try:
            self.recipe.update()
        finally:
            set_loader(old_loader)

        self.loader = loader