:py:mod:`anod.queries` ====================== .. py:module:: anod.queries .. autoapi-nested-parse:: Provides high level queries on Anod specs. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: anod.queries.SourceKey anod.queries.PackageKey anod.queries.SourceClosure Functions ~~~~~~~~~ .. autoapisummary:: anod.queries.get_build_node anod.queries.get_source_builder .. py:class:: SourceKey Bases: :py:obj:`NamedTuple` Key for identifying source packages in store queries. .. py:attribute:: anod_uid :type: str .. py:attribute:: src_name :type: str .. py:attribute:: publish :type: bool .. py:class:: PackageKey Bases: :py:obj:`NamedTuple` Key for identifying binary packages in store queries. .. py:attribute:: anod_uid :type: str .. py:attribute:: track :type: bool .. py:attribute:: has_closure :type: bool .. py:function:: get_build_node(anod_instance: e3.anod.spec.Anod, context: e3.anod.context.AnodContext, default: None = None) -> e3.anod.spec.Anod | None get_build_node(anod_instance: e3.anod.spec.Anod, context: e3.anod.context.AnodContext, default: e3.anod.spec.Anod) -> e3.anod.spec.Anod Return the build anod instance corresponding to an install. :param anod_instance: an Anod instance :param context: Anod context :param default: value returned if the build Anod instance does not exist :return: the associated build anod instance. If such instance does not exist then return default .. py:function:: get_source_builder(anod_instance: e3.anod.spec.Anod, source_name: str, local_sources_only: bool = False) -> e3.anod.package.SourceBuilder | None Given a source name return the associated builder. :param anod_instance: an Anod instance :param source_name: a source name :param local_sources_only: if True consider only builders declared in the spec itself. if False also consider source builders in source dependencies (i.e: require='source_pkg') :return: a source builder or None if no builder can be found. .. py:class:: SourceClosure(anod_instance: e3.anod.spec.Anod, context: e3.anod.context.AnodContext, expand_packages: bool = False, data_key: collections.abc.Callable[[Any], str] | None = None) Helper object to resolve source closure for a given spec instance. .. py:method:: compute_closure(spec: e3.anod.spec.Anod, publish: bool) -> None Compute the source closure (internal function). :param spec: an anod instance to inspect :param publish: whether the sources found should be marked as publishable or not .. py:method:: resolve_package(spec_uid: str, data: list[tuple[Any, bool]]) -> None Associate source information to a given package. :param spec_uid: the anod uid :param data: list of data associated to the package. This is a list of tuples (src_data, publish). Where src_data is the data for a given source package and publish a boolean indicated whether the entry is internal or not. .. py:method:: resolve_source(source_name: str, data: Any) -> None Associate source information to a given source. :param source_name: the source name :param data: data associated with the source .. py:method:: get_source_list() -> list[list[Any]] Get the closure source list. The function return the list of data for the sources in the closure. Note that if a package present in the closure is both marked as untracked and that closure cannot be found then it is ignored. For any other source or package if no data is associated then an assert exception will be raised :return: a list of list (source, publish)