Permalink
Browse files

Allow conda_install over multiple tool paths.

  • Loading branch information...
jmchilton committed Oct 4, 2016
1 parent f0da66f commit 2e4e5fc0442a20744254ee27cf4590b963773644
Showing with 15 additions and 10 deletions.
  1. +1 −1 planemo/commands/cmd_conda_env.py
  2. +3 −3 planemo/commands/cmd_conda_install.py
  3. +11 −6 planemo/conda.py
@@ -46,7 +46,7 @@ def cli(ctx, path, **kwds):
"""
conda_context = build_conda_context(ctx, use_planemo_shell_exec=False, **kwds)
conda_targets = collect_conda_targets(
path, conda_context=conda_context
ctx, path, conda_context=conda_context
)
installed_conda_targets = conda_util.filter_installed_targets(
conda_targets, conda_context=conda_context
@@ -11,11 +11,11 @@


@click.command('conda_install')
@options.optional_tools_arg()
@options.optional_tools_arg(multiple=True)
@options.conda_target_options()
@options.conda_auto_init_option()
@command_function
def cli(ctx, path, **kwds):
def cli(ctx, paths, **kwds):
"""Install conda packages for tool requirements."""
conda_context = build_conda_context(ctx, **kwds)
if not conda_context.is_conda_installed():
@@ -36,7 +36,7 @@ def cli(ctx, path, **kwds):
raise ExitCodeException(EXIT_CODE_FAILED_DEPENDENCIES)

return_codes = []
for conda_target in collect_conda_targets(path):
for conda_target in collect_conda_targets(ctx, paths):
ctx.log("Install conda target %s" % conda_target)
return_code = conda_util.install_conda_target(
conda_target, conda_context=conda_context
@@ -7,9 +7,9 @@
import os

from galaxy.tools.deps import conda_util
from galaxy.tools.loader_directory import load_tool_sources_from_path

from planemo.io import shell
from planemo.tools import yield_tool_sources_on_paths


def build_conda_context(ctx, **kwds):
@@ -29,13 +29,18 @@ def build_conda_context(ctx, **kwds):
shell_exec=shell_exec)


def collect_conda_targets(path, found_tool_callback=None, conda_context=None):
"""Load CondaTarget objects from supplied artifact sources."""
conda_targets = []
for (tool_path, tool_source) in load_tool_sources_from_path(path):
def collect_conda_targets(ctx, paths, found_tool_callback=None, conda_context=None):
"""Load CondaTarget objects from supplied artifact sources.
If a tool contains more than one requirement, the requirements will each
appear once in the output.
"""
conda_targets = set([])
for (tool_path, tool_source) in yield_tool_sources_on_paths(ctx, paths):
if found_tool_callback:
found_tool_callback(tool_path)
conda_targets.extend(tool_source_conda_targets(tool_source))
for target in tool_source_conda_targets(tool_source):
conda_targets.add(target)
return conda_targets


0 comments on commit 2e4e5fc

Please sign in to comment.