Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/planemo/linters/biocontainer_registered.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
comparison
equal
deleted
inserted
replaced
4:79f47841a781 | 5:9b1c78e6ba9c |
---|---|
1 """Ensure best-practice biocontainer registered for this tool.""" | |
2 | |
3 from galaxy.tool_util.deps.container_resolvers.mulled import targets_to_mulled_name | |
4 from galaxy.tool_util.deps.mulled.util import build_target | |
5 | |
6 from planemo.conda import tool_source_conda_targets | |
7 | |
8 MESSAGE_WARN_NO_REQUIREMENTS = "No valid package requirement tags found to infer BioContainer from." | |
9 MESSAGE_WARN_NO_CONTAINER = "Failed to find a BioContainer registered for these requirements." | |
10 MESSAGE_INFO_FOUND_BIOCONTAINER = "BioContainer best-practice container found [%s]." | |
11 | |
12 lint_tool_types = ["*"] | |
13 | |
14 | |
15 def lint_biocontainer_registered(tool_source, lint_ctx): | |
16 conda_targets = tool_source_conda_targets(tool_source) | |
17 if not conda_targets: | |
18 lint_ctx.warn(MESSAGE_WARN_NO_REQUIREMENTS) | |
19 return | |
20 | |
21 mulled_targets = [build_target(c.package, c.version) for c in conda_targets] | |
22 name = mulled_container_name("biocontainers", mulled_targets) | |
23 if name: | |
24 lint_ctx.info(MESSAGE_INFO_FOUND_BIOCONTAINER % name) | |
25 else: | |
26 lint_ctx.warn(MESSAGE_WARN_NO_CONTAINER) | |
27 | |
28 | |
29 def mulled_container_name(namespace, targets): | |
30 name = targets_to_mulled_name(targets=targets, hash_func="v2", namespace=namespace) | |
31 if name: | |
32 return "quay.io/%s/%s" % (namespace, name) |