How to use the lbuild.node.BaseNode.__init__ 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 / collector.py View on Github external
def __init__(self, option):
        BaseNode.__init__(self, option.name, BaseNode.Type.COLLECTOR)

        self._option = option
        self._description = option._description
        self._values = OrderedDict()
github modm-io / lbuild / lbuild / query.py View on Github external
def __init__(self, function, name=None):
        BaseNode.__init__(self, name, BaseNode.Type.QUERY)
        if not callable(function):
            raise LbuildQueryConstructionException(self, "'{}' must be callable!".format(function))
        fname = function.__name__
        if name is None:
            if "" in fname:
                raise LbuildQueryConstructionException(self, "'{}' must have a name!".format(function))
            self.name = fname

        descr = inspect.getdoc(function)
        if descr is not None:
            self._description = descr
        self.suffix = str(inspect.signature(function))
        self._function = function
github modm-io / lbuild / lbuild / option.py View on Github external
def __init__(self, name, description, default=None, dependencies=None,
                 convert_input=None, convert_output=None):
        BaseNode.__init__(self, name, BaseNode.Type.OPTION)
        self._dependency_handler = dependencies
        self.description = description
        self._in = str if convert_input is None else convert_input
        self._out = str if convert_output is None else convert_output
        self._input = None
        self._output = None
        self._default = None
        self._filename = os.path.join(os.getcwd(), "dummy")
        self._set_default(default)
github modm-io / lbuild / lbuild / parser.py View on Github external
def __init__(self, config=None):
        BaseNode.__init__(self, "lbuild", BaseNode.Type.PARSER)
        self._config = config if config else ConfigNode()
        self._config_flat = self._config.flatten()
github modm-io / lbuild / lbuild / repository.py View on Github external
def __init__(self, repo: RepositoryInit):
        """
        Construct a new repository object.

        At the construction time of the object, the name of repository may not
        be known e.g. if the repository is loaded from a `repo.lb` file.
        """
        BaseNode.__init__(self, repo.name, self.Type.REPOSITORY, self)

        self._filename = repo._filename
        self._description = repo.description
        self._functions = repo._functions
        self._format_description = repo._format_description
        self._format_short_description = repo._format_short_description
        self._build_order = sys.maxsize

        if repo.name is None:
            raise le.LbuildRepositoryNoNameException(repo._parser, repo)

        self._ignore_patterns.extend(repo._ignore_patterns)
        # Prefix the global filters with the `repo.` name
        for (name, func) in repo._filters:
            if not name.startswith("{}.".format(self.name)):
                nname = "{}.{}".format(self.name, name)
github modm-io / lbuild / lbuild / module.py View on Github external
def __init__(self, module: ModuleInit):
        """
        Create new module definition.

        Args:
            repository: Parent repository of the module.
            filename: Full path of the module file.
            path: Path to the module file. Used as base for relative paths
                during the building step of the module.
        """
        BaseNode.__init__(self, module.name, self.Type.MODULE, module.repository)

        self._filename = module.filename
        self._functions = module.functions
        self._description = module.description
        self._fullname = module.fullname
        self._available = module.available
        self._build_order = module.order

        # Prefix the global filters with the `repo.` name
        for (name, func) in module._filters:
            if not name.startswith("{}.".format(self._repository.name)):
                nname = "{}.{}".format(self._repository.name, name)
                LOGGER.warning("Namespacing module filter '{}' to '{}'!"
                               .format(name, nname))
                name = nname
            self._filters[name] = func