Mercurial > repos > shellac > guppy_basecaller
diff env/lib/python3.7/site-packages/planemo/linters/conda_requirements.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
| author | shellac |
|---|---|
| date | Sat, 02 May 2020 07:14:21 -0400 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/lib/python3.7/site-packages/planemo/linters/conda_requirements.py Sat May 02 07:14:21 2020 -0400 @@ -0,0 +1,35 @@ +"""Ensure requirements are matched in best practice conda channels.""" + +from planemo.conda import ( + BEST_PRACTICE_CHANNELS, + best_practice_search, + tool_source_conda_targets, +) + +lint_tool_types = ["*"] + + +def lint_requirements_in_conda(tool_source, lint_ctx): + """Check requirements of tool source against best practice Conda channels.""" + conda_targets = tool_source_conda_targets(tool_source) + if not conda_targets: + lint_ctx.warn("No valid package requirement tags found to check against Conda.") + return + + for conda_target in conda_targets: + (best_hit, exact) = best_practice_search(conda_target) + conda_target_str = conda_target.package + if conda_target.version: + conda_target_str += "@%s" % (conda_target.version) + if best_hit and exact: + template = "Requirement [%s] matches target in best practice Conda channel [%s]." + message = template % (conda_target_str, best_hit.get("channel")) + lint_ctx.info(message) + elif best_hit: + template = "Requirement [%s] doesn't exactly match available version [%s] in best practice Conda channel [%s]." + message = template % (conda_target_str, best_hit['version'], best_hit.get("channel")) + lint_ctx.warn(message) + else: + template = "Requirement [%s] doesn't match any recipe in a best practice conda channel [%s]." + message = template % (conda_target_str, BEST_PRACTICE_CHANNELS) + lint_ctx.warn(message)
