Skip to content

Commit 2e4e5fc

Browse files
committed
Allow conda_install over multiple tool paths.
1 parent f0da66f commit 2e4e5fc

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

planemo/commands/cmd_conda_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def cli(ctx, path, **kwds):
4646
"""
4747
conda_context = build_conda_context(ctx, use_planemo_shell_exec=False, **kwds)
4848
conda_targets = collect_conda_targets(
49-
path, conda_context=conda_context
49+
ctx, path, conda_context=conda_context
5050
)
5151
installed_conda_targets = conda_util.filter_installed_targets(
5252
conda_targets, conda_context=conda_context

planemo/commands/cmd_conda_install.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212

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

3838
return_codes = []
39-
for conda_target in collect_conda_targets(path):
39+
for conda_target in collect_conda_targets(ctx, paths):
4040
ctx.log("Install conda target %s" % conda_target)
4141
return_code = conda_util.install_conda_target(
4242
conda_target, conda_context=conda_context

planemo/conda.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import os
88

99
from galaxy.tools.deps import conda_util
10-
from galaxy.tools.loader_directory import load_tool_sources_from_path
1110

1211
from planemo.io import shell
12+
from planemo.tools import yield_tool_sources_on_paths
1313

1414

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

3131

32-
def collect_conda_targets(path, found_tool_callback=None, conda_context=None):
33-
"""Load CondaTarget objects from supplied artifact sources."""
34-
conda_targets = []
35-
for (tool_path, tool_source) in load_tool_sources_from_path(path):
32+
def collect_conda_targets(ctx, paths, found_tool_callback=None, conda_context=None):
33+
"""Load CondaTarget objects from supplied artifact sources.
34+
35+
If a tool contains more than one requirement, the requirements will each
36+
appear once in the output.
37+
"""
38+
conda_targets = set([])
39+
for (tool_path, tool_source) in yield_tool_sources_on_paths(ctx, paths):
3640
if found_tool_callback:
3741
found_tool_callback(tool_path)
38-
conda_targets.extend(tool_source_conda_targets(tool_source))
42+
for target in tool_source_conda_targets(tool_source):
43+
conda_targets.add(target)
3944
return conda_targets
4045

4146

0 commit comments

Comments
 (0)