How to use the lbuild.utils.with_forward_exception function in lbuild

To help you get started, we’ve selected a few lbuild examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github modm-io / lbuild / lbuild / repository.py View on Github external
def init(self):
        lbuild.utils.with_forward_exception(self,
                lambda: self._functions['init'](lf.RepositoryInitFacade(self)))
        return Repository(self)
github modm-io / lbuild / lbuild / module.py View on Github external
def init(self):
        # Execute init() function from module to get module name
        lbuild.utils.with_forward_exception(
            self,
            lambda: self.functions['init'](lf.ModuleInitFacade(self)))

        if self.name is None:
            raise le.LbuildModuleNoNameException(self)

        if self.parent is None and ":" not in self.name:
            self.parent = self.context_parent

        parent_parent, parent_name = self._clean(self.parent)
        name_parent, self.name = self._clean(self.name)

        self.parent = ":".join(p.strip(":") for p in (self.repository.name,
                                parent_parent, parent_name, name_parent) if p)

        self.order = int(self.order)
github modm-io / lbuild / lbuild / module.py View on Github external
def validate(self, env):
        validate = self._functions.get("validate", self._functions.get("pre_build", None))
        if validate is not None:
            LOGGER.info("Validate {}".format(self.fullname))
            lbuild.utils.with_forward_exception(self, lambda: validate(env.facade))
github modm-io / lbuild / lbuild / repository.py View on Github external
def build(self, env):
        build = self._functions.get("build", None)
        if build is not None:
            LOGGER.info("Build %s", self.fullname)
            lbuild.utils.with_forward_exception(self, lambda: build(env.facade))
github modm-io / lbuild / lbuild / module.py View on Github external
def prepare(self):
        self.available = lbuild.utils.with_forward_exception(
            self,
            lambda: self.functions["prepare"](lf.ModulePrepareFacade(self),
                                              self.repository.option_value_resolver))

        all_modules = [self]
        if self.available is None:
            raise le.LbuildModuleNoReturnAvailableException(self)

        for submodule in self._submodules:
            if isinstance(submodule, str):
                modules = load_module_from_file(repository=self.repository,
                                                filename=os.path.join(self.filepath, submodule),
                                                parent=self.fullname)
            else:
                modules = load_module_from_object(repository=self.repository,
                                                  module_obj=submodule,
github modm-io / lbuild / lbuild / repository.py View on Github external
def prepare(self):
        lbuild.utils.with_forward_exception(
            self,
            lambda: self._functions["prepare"](lf.RepositoryPrepareFacade(self),
                                               self.option_value_resolver))

        modules = []
        # Parse the module files inside this repository
        for modulefile in self._module_files:
            module = lbuild.module.load_module_from_file(repository=self,
                                                         filename=modulefile)
            modules.extend(module)
        # Parse the module objects inside the repo file
        for submodule in self._submodules:
            module = lbuild.module.load_module_from_object(repository=self,
                                                           module_obj=submodule,
                                                           filename=self._filename)
            modules.extend(module)
github modm-io / lbuild / lbuild / module.py View on Github external
def post_build(self, env):
        post_build = self._functions.get("post_build", None)
        if post_build is not None:
            LOGGER.info("Post-Build {}".format(self.fullname))
            if len(inspect.signature(post_build).parameters.keys()) == 1:
                func = lambda: post_build(env.facade)
            else:
                func = lambda: post_build(env.facade, env.facade_buildlog)
            lbuild.utils.with_forward_exception(self, func)