Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/planemo/mulled.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 """Planemo specific utilities for dealing with mulled containers. | |
2 | |
3 The extend galaxy-tool-util's features with planemo specific idioms. | |
4 """ | |
5 from __future__ import absolute_import | |
6 | |
7 import os | |
8 | |
9 from galaxy.tool_util.deps.mulled.mulled_build import ( | |
10 DEFAULT_CHANNELS, | |
11 ensure_installed, | |
12 InvolucroContext, | |
13 ) | |
14 from galaxy.tool_util.deps.mulled.util import build_target | |
15 | |
16 from planemo.conda import collect_conda_target_lists | |
17 from planemo.io import shell | |
18 | |
19 | |
20 def conda_to_mulled_targets(conda_targets): | |
21 return list(map(lambda c: build_target(c.package, c.version), conda_targets)) | |
22 | |
23 | |
24 def collect_mulled_target_lists(ctx, paths, recursive=False): | |
25 return list(map(conda_to_mulled_targets, collect_conda_target_lists(ctx, paths, recursive=recursive))) | |
26 | |
27 | |
28 def build_involucro_context(ctx, **kwds): | |
29 """Build a galaxy-tool-util InvolucroContext tailored to planemo use. | |
30 | |
31 Using planemo's common command-line/global config options. | |
32 """ | |
33 involucro_path_default = os.path.join(ctx.workspace, "involucro") | |
34 involucro_path = kwds.get("involucro_path", involucro_path_default) | |
35 use_planemo_shell = kwds.get("use_planemo_shell_exec", True) | |
36 shell_exec = shell if use_planemo_shell else None | |
37 involucro_context = InvolucroContext(involucro_bin=involucro_path, | |
38 shell_exec=shell_exec) | |
39 if not ensure_installed(involucro_context, True): | |
40 raise Exception("Failed to install involucro for Planemo.") | |
41 return involucro_context | |
42 | |
43 | |
44 def build_mull_target_kwds(ctx, **kwds): | |
45 """Adapt Planemo's CLI and workspace configuration to galaxy-tool-util's mulled_build options.""" | |
46 involucro_context = build_involucro_context(ctx, **kwds) | |
47 channels = kwds.get("conda_ensure_channels", ",".join(DEFAULT_CHANNELS)) | |
48 namespace = kwds.get("mulled_namespace", "biocontainers") | |
49 target_kwds = { | |
50 'involucro_context': involucro_context, | |
51 'channels': channels.split(","), | |
52 'namespace': namespace, | |
53 'verbose': ctx.verbose, | |
54 } | |
55 | |
56 conda_version = kwds.get("mulled_conda_version", None) | |
57 if conda_version is not None: | |
58 target_kwds["conda_version"] = conda_version | |
59 return target_kwds | |
60 | |
61 | |
62 __all__ = ( | |
63 "build_involucro_context", | |
64 "build_mull_target_kwds", | |
65 "collect_mulled_target_lists", | |
66 "conda_to_mulled_targets", | |
67 ) |