Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/planemo/linters/conda_requirements.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 requirements are matched in best practice conda channels.""" | |
| 2 | |
| 3 from planemo.conda import ( | |
| 4 BEST_PRACTICE_CHANNELS, | |
| 5 best_practice_search, | |
| 6 tool_source_conda_targets, | |
| 7 ) | |
| 8 | |
| 9 lint_tool_types = ["*"] | |
| 10 | |
| 11 | |
| 12 def lint_requirements_in_conda(tool_source, lint_ctx): | |
| 13 """Check requirements of tool source against best practice Conda channels.""" | |
| 14 conda_targets = tool_source_conda_targets(tool_source) | |
| 15 if not conda_targets: | |
| 16 lint_ctx.warn("No valid package requirement tags found to check against Conda.") | |
| 17 return | |
| 18 | |
| 19 for conda_target in conda_targets: | |
| 20 (best_hit, exact) = best_practice_search(conda_target) | |
| 21 conda_target_str = conda_target.package | |
| 22 if conda_target.version: | |
| 23 conda_target_str += "@%s" % (conda_target.version) | |
| 24 if best_hit and exact: | |
| 25 template = "Requirement [%s] matches target in best practice Conda channel [%s]." | |
| 26 message = template % (conda_target_str, best_hit.get("channel")) | |
| 27 lint_ctx.info(message) | |
| 28 elif best_hit: | |
| 29 template = "Requirement [%s] doesn't exactly match available version [%s] in best practice Conda channel [%s]." | |
| 30 message = template % (conda_target_str, best_hit['version'], best_hit.get("channel")) | |
| 31 lint_ctx.warn(message) | |
| 32 else: | |
| 33 template = "Requirement [%s] doesn't match any recipe in a best practice conda channel [%s]." | |
| 34 message = template % (conda_target_str, BEST_PRACTICE_CHANNELS) | |
| 35 lint_ctx.warn(message) |
