How to use the lbuild.exception.LbuildResolverSearchException 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 / node.py View on Github external
def _get_node(self, key, check_dependencies=False, raise_on_fail=True):
        node = self._node._resolve_partial_max(key, max_results=1, raise_on_fail=raise_on_fail)
        if node is None: return None;
        node = node[0]
        if not node._available:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not available!")

        if self._selected and not node._selected:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not selected!")

        if node._type != self._type:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node,
                    "is of type '{}', but searching for '{}'!".format(
                            node._type.name.lower(), self._type.name.lower()))

        if check_dependencies and node.type in {BaseNode.Type.OPTION, BaseNode.Type.QUERY, BaseNode.Type.COLLECTOR}:
            if node.parent != self._node:
                if all(n.type not in {BaseNode.Type.PARSER, BaseNode.Type.REPOSITORY} for n in {self._node, node.module}):
                    if node.parent not in self._node.dependencies:
                        if self._selected or node.type not in {BaseNode.Type.COLLECTOR}:
                            LOGGER.warning("Module '{}' accessing '{}' without depending on '{}'!"
                                           .format(self._node.fullname, node.fullname, node.module.fullname))

        return node
github modm-io / lbuild / lbuild / node.py View on Github external
def _get_node(self, key, check_dependencies=False, raise_on_fail=True):
        node = self._node._resolve_partial_max(key, max_results=1, raise_on_fail=raise_on_fail)
        if node is None: return None;
        node = node[0]
        if not node._available:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not available!")

        if self._selected and not node._selected:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not selected!")

        if node._type != self._type:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node,
                    "is of type '{}', but searching for '{}'!".format(
                            node._type.name.lower(), self._type.name.lower()))

        if check_dependencies and node.type in {BaseNode.Type.OPTION, BaseNode.Type.QUERY, BaseNode.Type.COLLECTOR}:
            if node.parent != self._node:
                if all(n.type not in {BaseNode.Type.PARSER, BaseNode.Type.REPOSITORY} for n in {self._node, node.module}):
                    if node.parent not in self._node.dependencies:
                        if self._selected or node.type not in {BaseNode.Type.COLLECTOR}:
github modm-io / lbuild / lbuild / node.py View on Github external
def _get_node(self, key, check_dependencies=False, raise_on_fail=True):
        node = self._node._resolve_partial_max(key, max_results=1, raise_on_fail=raise_on_fail)
        if node is None: return None;
        node = node[0]
        if not node._available:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not available!")

        if self._selected and not node._selected:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node, "is not selected!")

        if node._type != self._type:
            if not raise_on_fail: return None;
            raise le.LbuildResolverSearchException(self, node,
                    "is of type '{}', but searching for '{}'!".format(
                            node._type.name.lower(), self._type.name.lower()))

        if check_dependencies and node.type in {BaseNode.Type.OPTION, BaseNode.Type.QUERY, BaseNode.Type.COLLECTOR}:
            if node.parent != self._node:
                if all(n.type not in {BaseNode.Type.PARSER, BaseNode.Type.REPOSITORY} for n in {self._node, node.module}):
                    if node.parent not in self._node.dependencies:
                        if self._selected or node.type not in {BaseNode.Type.COLLECTOR}:
                            LOGGER.warning("Module '{}' accessing '{}' without depending on '{}'!"
                                           .format(self._node.fullname, node.fullname, node.module.fullname))

        return node