Exemple #1
0
def render(recipe_path,
           config=None,
           variants=None,
           permit_unsatisfiable_variants=True,
           **kwargs):
    """Given path to a recipe, return the MetaData object(s) representing that recipe, with jinja2
       templates evaluated.

    Returns a list of (metadata, needs_download, needs_reparse in env) tuples"""
    from conda_build.render import render_recipe, finalize_metadata
    from conda_build.exceptions import DependencyNeedsBuildingError
    config = get_or_merge_config(config, **kwargs)
    metadata_tuples, index = render_recipe(
        recipe_path,
        no_download_source=config.no_download_source,
        config=config,
        variants=variants,
        permit_unsatisfiable_variants=permit_unsatisfiable_variants)

    metadata = []
    for (_m, download, reparse) in metadata_tuples:
        for (output_dict, m) in _m.get_output_metadata_set():
            if output_dict.get('type') != 'wheel':
                try:
                    m = finalize_metadata(m, index)
                except DependencyNeedsBuildingError:
                    log = _get_logger(__name__)
                    log.warn(
                        "Could not finalize metadata due to missing dependencies.  "
                        "If building, these should get built in order and it's OK to "
                        "ignore this message..")
                metadata.append((m, download, reparse))
    return metadata
Exemple #2
0
def get_output_file_path(recipe_path_or_metadata, no_download_source=False, config=None,
                         variants=None, **kwargs):
    """Get output file paths for any packages that would be created by a recipe

    Both split packages (recipes with more than one ouptut) and build matrices,
    created with variants, contribute to the list of file paths here.
    """
    log = _get_logger(__name__)
    log.warn("deprecation warning: this function has been renamed to get_output_file_paths, "
             "to reflect that potentially multiple paths are returned.  This function will be "
             "removed in the conda-build 4.0 release.")
    return get_output_file_paths(recipe_path_or_metadata, no_download_source=no_download_source,
                                 config=config, variants=variants, **kwargs)
Exemple #3
0
def get_output_file_path(recipe_path_or_metadata, no_download_source=False, config=None,
                         variants=None, **kwargs):
    """Get output file paths for any packages that would be created by a recipe

    Both split packages (recipes with more than one output) and build matrices,
    created with variants, contribute to the list of file paths here.
    """
    log = _get_logger(__name__)
    log.warn("deprecation warning: this function has been renamed to get_output_file_paths, "
             "to reflect that potentially multiple paths are returned.  This function will be "
             "removed in the conda-build 4.0 release.")
    return get_output_file_paths(recipe_path_or_metadata,
                                 no_download_source=no_download_source,
                                 config=config, variants=variants, **kwargs)
Exemple #4
0
def render(recipe_path,
           config=None,
           variants=None,
           permit_unsatisfiable_variants=True,
           finalize=True,
           **kwargs):
    """Given path to a recipe, return the MetaData object(s) representing that recipe, with jinja2
       templates evaluated.

    Returns a list of (metadata, needs_download, needs_reparse in env) tuples"""
    from conda_build.render import render_recipe, finalize_metadata
    from conda_build.exceptions import DependencyNeedsBuildingError
    from conda_build.conda_interface import NoPackagesFoundError
    from collections import OrderedDict
    config = get_or_merge_config(config, **kwargs)
    log = _get_logger(__name__)

    metadata_tuples = render_recipe(
        recipe_path,
        no_download_source=config.no_download_source,
        config=config,
        variants=variants,
        permit_unsatisfiable_variants=permit_unsatisfiable_variants)
    output_metas = OrderedDict()
    for meta, download, render_in_env in metadata_tuples:
        for od, om in meta.get_output_metadata_set(
                permit_unsatisfiable_variants=permit_unsatisfiable_variants):
            # only show conda packages right now
            if 'type' not in od or od['type'] == 'conda':
                assert hasattr(om.config, 'variants')
                if finalize:
                    try:
                        om = finalize_metadata(om)
                    except (DependencyNeedsBuildingError,
                            NoPackagesFoundError):
                        if permit_unsatisfiable_variants:
                            log.warn(
                                "Returning non-final recipe; one or more dependencies "
                                "was unsatisfiable.")
                        else:
                            raise
                output_metas[om.dist()] = ((om, download, render_in_env))
    return list(output_metas.values())