Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/planemo/linters/biocontainer_registered.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
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) |