def _get_repo_version(repo_path, variants, variant_config_files=None):
    '''
    Get the version of the first package that appears in the recipes list for the feedstock.
    '''
    saved_working_directory = os.getcwd()
    os.chdir(os.path.abspath(repo_path))
    for variant in variants:
        build_config_data, _ = build_feedstock.load_package_config(
            variants=variant, permit_undefined_jinja=True)
        if build_config_data["recipes"]:
            for recipe in build_config_data["recipes"]:
                rendered_recipe = conda_utils.render_yaml(
                    recipe["path"],
                    variants=variant,
                    variant_config_files=variant_config_files,
                    permit_undefined_jinja=True)
                for meta, _, _ in rendered_recipe:
                    package_version = meta.meta['package']['version']
                    if package_version and package_version != "None":
                        os.chdir(saved_working_directory)
                        return package_version, meta.meta['package']['name']

    os.chdir(saved_working_directory)
    raise Exception(
        "Error: Unable to determine current version of the feedstock")
Exemplo n.º 2
0
def _create_commands(repository, runtime_package, recipe_path, recipes,
                     variant_config_files, variants, channels):
    """
    Returns:
        A tree of nodes containing BuildCommands for each recipe within a repository.
    """
    retval = graph.OpenCEGraph()
    saved_working_directory = os.getcwd()
    os.chdir(repository)

    config_data, _ = build_feedstock.load_package_config(
        variants=variants, recipe_path=recipe_path)
    combined_config_files = [
        utils.download_file(config) if utils.is_url(config) else config
        for config in variant_config_files
    ]
    feedstock_conda_build_config_file = build_feedstock.get_conda_build_config(
    )
    if feedstock_conda_build_config_file:
        combined_config_files.append(feedstock_conda_build_config_file)

    recipes_from_config = config_data.get('recipes', [])
    if recipes_from_config is None:
        recipes_from_config = []

    channels_from_config = config_data.get('channels', [])
    if channels_from_config is not None:
        channels += channels_from_config

    for recipe in recipes_from_config:
        if recipes and not recipe.get('name') in recipes:
            continue
        packages, version, run_deps, host_deps, build_deps, test_deps, output_files = _get_package_dependencies(
            recipe.get('path'), combined_config_files, variants)
        build_command = BuildCommand(recipe=recipe.get('name', None),
                                     repository=repository,
                                     packages=packages,
                                     version=version,
                                     recipe_path=recipe_path,
                                     runtime_package=runtime_package,
                                     output_files=output_files,
                                     python=variants.get('python'),
                                     build_type=variants.get('build_type'),
                                     mpi_type=variants.get('mpi_type'),
                                     cudatoolkit=variants.get('cudatoolkit'),
                                     run_dependencies=run_deps,
                                     host_dependencies=host_deps,
                                     build_dependencies=build_deps,
                                     test_dependencies=test_deps,
                                     channels=channels,
                                     resources=recipe.get('resources'),
                                     conda_build_configs=variant_config_files)
        package_node = DependencyNode(set(packages), build_command)
        retval.add_node(package_node)

    os.chdir(saved_working_directory)
    return retval
Exemplo n.º 3
0
def get_configs(variant, conda_build_config=utils.DEFAULT_CONDA_BUILD_CONFIG):
    build_config_data, _ = build_feedstock.load_package_config(
        variants=variant)
    config = get_or_merge_config(None, variant=variant)
    config.variant_config_files = [conda_build_config]
    config.verbose = False
    recipe_conda_build_config = build_feedstock.get_conda_build_config()
    if recipe_conda_build_config:
        config.variant_config_files.append(recipe_conda_build_config)
    return build_config_data, config
Exemplo n.º 4
0
def get_configs(variant, conda_build_config=None):
    build_config_data, _ = build_feedstock.load_package_config(
        variants=variant)
    config = get_or_merge_config(None, variant=variant)
    config.variant_config_files = conda_build_config if conda_build_config else []
    config.verbose = False
    recipe_conda_build_config = build_feedstock.get_conda_build_config()
    if recipe_conda_build_config:
        config.variant_config_files.append(recipe_conda_build_config)
    return build_config_data, config
Exemplo n.º 5
0
def _create_commands(repository, runtime_package, recipe_path, recipes,
                     variant_config_files, variants, channels):
    """
    Returns:
        A list of BuildCommands for each recipe within a repository.
        A list of TestCommands for an entire repository.
    """
    saved_working_directory = os.getcwd()
    os.chdir(repository)

    config_data, _ = build_feedstock.load_package_config(
        variants=variants, recipe_path=recipe_path)
    combined_config_files = variant_config_files

    feedstock_conda_build_config_file = build_feedstock.get_conda_build_config(
    )
    if feedstock_conda_build_config_file:
        combined_config_files.append(feedstock_conda_build_config_file)
    build_commands = []
    recipes_from_config = config_data.get('recipes', [])
    if recipes_from_config is None:
        recipes_from_config = []
    for recipe in recipes_from_config:
        if recipes and not recipe.get('name') in recipes:
            continue
        packages, version, run_deps, host_deps, build_deps, test_deps, output_files = _get_package_dependencies(
            recipe.get('path'), combined_config_files, variants)

        build_commands.append(
            BuildCommand(recipe=recipe.get('name', None),
                         repository=repository,
                         packages=packages,
                         version=version,
                         recipe_path=recipe_path,
                         runtime_package=runtime_package,
                         output_files=output_files,
                         python=variants['python'],
                         build_type=variants['build_type'],
                         mpi_type=variants['mpi_type'],
                         cudatoolkit=variants['cudatoolkit'],
                         run_dependencies=run_deps,
                         host_dependencies=host_deps,
                         build_dependencies=build_deps,
                         test_dependencies=test_deps,
                         channels=channels))

    os.chdir(saved_working_directory)
    return build_commands
Exemplo n.º 6
0
def _get_repo_version(repo_path):
    '''
    Get the version of the first package that appears in the recipes list for the feedstock.
    '''
    saved_working_directory = os.getcwd()
    os.chdir(os.path.abspath(repo_path))

    build_config_data, _ = build_feedstock.load_package_config()

    for recipe in build_config_data["recipes"]:
        rendered_recipe = conda_utils.render_yaml(recipe["path"])
        for meta, _, _ in rendered_recipe:
            package_version = meta.meta['package']['version']
            if package_version and package_version != "None":
                os.chdir(saved_working_directory)
                return package_version

    os.chdir(saved_working_directory)
    raise Exception(
        "Error: Unable to determine current version of the feedstock")