Example #1
0
def build(recipe_paths_or_metadata, post=None, need_source_download=True,
          build_only=False, notest=False, config=None, **kwargs):
    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    config = get_or_merge_config(config, **kwargs)

    recipe_paths_or_metadata = _ensure_list(recipe_paths_or_metadata)
    string_paths = [p for p in recipe_paths_or_metadata if isinstance(p, string_types)]
    paths = _expand_globs(string_paths, os.getcwd())
    recipes = []
    for recipe in paths[:]:
        try:
            recipes.append(find_recipe(recipe))
        except IOError:
            pass
    metadata = [m for m in recipe_paths_or_metadata if hasattr(m, 'config')]
    recipes.extend(metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config") or os.path.isabs(recipe):
            absolute_recipes.append(recipe)
        else:
            absolute_recipes.append(os.path.normpath(os.path.join(os.getcwd(), recipe)))

    return build_tree(absolute_recipes, build_only=build_only, post=post, notest=notest,
                      need_source_download=need_source_download, config=config)
Example #2
0
def build(recipe_paths_or_metadata,
          post=None,
          need_source_download=True,
          build_only=False,
          notest=False,
          config=None,
          **kwargs):
    import os
    from conda_build.build import build_tree

    config = get_or_merge_config(config, **kwargs)

    recipes = _ensure_list(recipe_paths_or_metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config"):
            absolute_recipes.append(recipe)
        elif os.path.isabs(recipe):
            absolute_recipes.append(recipe)
        else:
            absolute_recipes.append(
                os.path.normpath(os.path.join(os.getcwd(), recipe)))

    return build_tree(absolute_recipes,
                      build_only=build_only,
                      post=post,
                      notest=notest,
                      need_source_download=need_source_download,
                      config=config)
Example #3
0
def build(recipe_paths_or_metadata, post=None, need_source_download=True,
          build_only=False, notest=False, config=None, variants=None, stats=None,
          **kwargs):
    """Run the build step.

    If recipe paths are provided, renders recipe before building.
    Tests built packages by default.  notest=True to skip test."""

    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    assert post in (None, True, False), ("post must be boolean or None.  Remember, you must pass "
                                         "other arguments (config) by keyword.")

    config = get_or_merge_config(config, **kwargs)

    # if people don't pass in an object to capture stats in, they won't get them returned.
    #     We'll still track them, though.
    if not stats:
        stats = {}

    recipe_paths_or_metadata = _ensure_list(recipe_paths_or_metadata)
    for recipe in recipe_paths_or_metadata:
        if not any((hasattr(recipe, "config"), isinstance(recipe, string_types))):
            raise ValueError("Recipe passed was unrecognized object: {}".format(recipe))
    string_paths = [p for p in recipe_paths_or_metadata if isinstance(p, string_types)]
    paths = _expand_globs(string_paths, os.getcwd())
    recipes = []
    for recipe in paths:
        if (os.path.isdir(recipe) or
                (os.path.isfile(recipe) and
                 os.path.basename(recipe) in ('meta.yaml', 'conda.yaml'))):
            try:
                recipes.append(find_recipe(recipe))
            except IOError:
                continue
    metadata = [m for m in recipe_paths_or_metadata if hasattr(m, 'config')]

    recipes.extend(metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config"):
            absolute_recipes.append(recipe)
        else:
            if not os.path.isabs(recipe):
                recipe = os.path.normpath(os.path.join(os.getcwd(), recipe))
            if not os.path.exists(recipe):
                raise ValueError("Path to recipe did not exist: {}".format(recipe))
            absolute_recipes.append(recipe)

    if not absolute_recipes:
        raise ValueError('No valid recipes found for input: {}'.format(recipe_paths_or_metadata))
    return build_tree(absolute_recipes, config, stats, build_only=build_only, post=post,
                      notest=notest, need_source_download=need_source_download, variants=variants)
Example #4
0
def build(recipe_paths_or_metadata, post=None, need_source_download=True,
          build_only=False, notest=False, config=None, variants=None, stats=None,
          **kwargs):
    """Run the build step.

    If recipe paths are provided, renders recipe before building.
    Tests built packages by default.  notest=True to skip test."""

    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    assert post in (None, True, False), ("post must be boolean or None.  Remember, you must pass "
                                         "other arguments (config) by keyword.")

    config = get_or_merge_config(config, **kwargs)

    # if people don't pass in an object to capture stats in, they won't get them returned.
    #     We'll still track them, though.
    if not stats:
        stats = {}

    recipe_paths_or_metadata = _ensure_list(recipe_paths_or_metadata)
    for recipe in recipe_paths_or_metadata:
        if not any((hasattr(recipe, "config"), isinstance(recipe, string_types))):
            raise ValueError("Recipe passed was unrecognized object: {}".format(recipe))
    string_paths = [p for p in recipe_paths_or_metadata if isinstance(p, string_types)]
    paths = _expand_globs(string_paths, os.getcwd())
    recipes = []
    for recipe in paths:
        if (os.path.isdir(recipe) or
                (os.path.isfile(recipe) and
                 os.path.basename(recipe) in ('meta.yaml', 'conda.yaml'))):
            try:
                recipes.append(find_recipe(recipe))
            except IOError:
                continue
    metadata = [m for m in recipe_paths_or_metadata if hasattr(m, 'config')]

    recipes.extend(metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config"):
            absolute_recipes.append(recipe)
        else:
            if not os.path.isabs(recipe):
                recipe = os.path.normpath(os.path.join(os.getcwd(), recipe))
            if not os.path.exists(recipe):
                raise ValueError("Path to recipe did not exist: {}".format(recipe))
            absolute_recipes.append(recipe)

    if not absolute_recipes:
        raise ValueError('No valid recipes found for input: {}'.format(recipe_paths_or_metadata))
    return build_tree(sorted(absolute_recipes), config, stats, build_only=build_only, post=post,
                      notest=notest, variants=variants)
Example #5
0
def build(recipe_paths_or_metadata,
          post=None,
          need_source_download=True,
          build_only=False,
          notest=False,
          config=None,
          **kwargs):
    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    assert post in (None, True, False), (
        "post must be boolean or None.  Remember, you must pass "
        "other arguments (config) by keyword.")

    config = get_or_merge_config(config, **kwargs)

    recipe_paths_or_metadata = _ensure_list(recipe_paths_or_metadata)
    for recipe in recipe_paths_or_metadata:
        if not any(
            (hasattr(recipe, "config"), isinstance(recipe, string_types))):
            raise ValueError(
                "Recipe passed was unrecognized object: {}".format(recipe))
    string_paths = [
        p for p in recipe_paths_or_metadata if isinstance(p, string_types)
    ]
    paths = _expand_globs(string_paths, os.getcwd())
    recipes = []
    for recipe in paths:
        try:
            recipes.append(find_recipe(recipe))
        except IOError:
            pass
    metadata = [m for m in recipe_paths_or_metadata if hasattr(m, 'config')]
    recipes.extend(metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config"):
            absolute_recipes.append(recipe)
        else:
            if not os.path.isabs(recipe):
                recipe = os.path.normpath(os.path.join(os.getcwd(), recipe))
            if not os.path.exists(recipe):
                raise ValueError(
                    "Path to recipe did not exist: {}".format(recipe))
            absolute_recipes.append(recipe)

    return build_tree(absolute_recipes,
                      build_only=build_only,
                      post=post,
                      notest=notest,
                      need_source_download=need_source_download,
                      config=config)
Example #6
0
def build(recipe_paths_or_metadata,
          post=None,
          need_source_download=True,
          build_only=False,
          notest=False,
          config=None,
          variants=None,
          stats=None,
          **kwargs):
    """Run the build step.

    If recipe paths are provided, renders recipe before building.
    Tests built packages by default.  notest=True to skip test."""
    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    assert post in (None, True, False), (
        "post must be boolean or None.  Remember, you must pass "
        "other arguments (config) by keyword.")

    recipes = []
    for recipe in _ensure_list(recipe_paths_or_metadata):
        if isinstance(recipe, string_types):
            for recipe in _expand_globs(recipe, os.getcwd()):
                try:
                    recipe = find_recipe(recipe)
                except IOError:
                    continue
                recipes.append(recipe)
        elif hasattr(recipe, "config"):
            recipes.append(recipe)
        else:
            raise ValueError(
                "Recipe passed was unrecognized object: {}".format(recipe))

    if not recipes:
        raise ValueError('No valid recipes found for input: {}'.format(
            recipe_paths_or_metadata))

    return build_tree(
        sorted(recipes),
        config=get_or_merge_config(config, **kwargs),
        # If people don't pass in an object to capture stats in, they won't get them returned.
        # We'll still track them, though.
        stats=stats or {},
        build_only=build_only,
        post=post,
        notest=notest,
        variants=variants)
Example #7
0
def build(recipe_paths_or_metadata, post=None, need_source_download=True,
          build_only=False, notest=False, config=None, **kwargs):
    import os
    from conda_build.build import build_tree

    config = get_or_merge_config(config, **kwargs)

    recipes = _ensure_list(recipe_paths_or_metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config"):
            absolute_recipes.append(recipe)
        elif os.path.isabs(recipe):
            absolute_recipes.append(recipe)
        else:
            absolute_recipes.append(os.path.normpath(os.path.join(os.getcwd(), recipe)))

    return build_tree(absolute_recipes, build_only=build_only, post=post, notest=notest,
                      need_source_download=need_source_download, config=config)
Example #8
0
def build(recipe_paths_or_metadata,
          post=None,
          need_source_download=True,
          build_only=False,
          notest=False,
          config=None,
          **kwargs):
    import os
    from conda_build.build import build_tree
    from conda_build.conda_interface import string_types
    from conda_build.utils import find_recipe

    config = get_or_merge_config(config, **kwargs)

    recipe_paths_or_metadata = _ensure_list(recipe_paths_or_metadata)
    string_paths = [
        p for p in recipe_paths_or_metadata if isinstance(p, string_types)
    ]
    paths = _expand_globs(string_paths, os.getcwd())
    recipes = []
    for recipe in paths[:]:
        try:
            recipes.append(find_recipe(recipe))
        except IOError:
            pass
    metadata = [m for m in recipe_paths_or_metadata if hasattr(m, 'config')]
    recipes.extend(metadata)
    absolute_recipes = []
    for recipe in recipes:
        if hasattr(recipe, "config") or os.path.isabs(recipe):
            absolute_recipes.append(recipe)
        else:
            absolute_recipes.append(
                os.path.normpath(os.path.join(os.getcwd(), recipe)))

    return build_tree(absolute_recipes,
                      build_only=build_only,
                      post=post,
                      notest=notest,
                      need_source_download=need_source_download,
                      config=config)