Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ output/*/index.html
docs/_build

.venv
.venv3

tool_test_output.*

Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ ENV?=py27
ARGS?=
# Location of virtualenv used for development.
VENV?=.venv
VENV3?=.venv3
# Open resource on Mac OS X or Linux
OPEN_RESOURCE=bash -c 'open $$0 || xdg-open $$0'
# Source virtualenv to execute command (flake8, sphinx, twine, etc...)
IN_VENV=if [ -f $(VENV)/bin/activate ]; then . $(VENV)/bin/activate; fi;
IN_VENV3=if [ -f $(VENV3)/bin/activate ]; then . $(VENV3)/bin/activate; fi;
# TODO: add this upstream as a remote if it doesn't already exist.
UPSTREAM?=galaxyproject
SOURCE_DIR?=planemo
Expand Down Expand Up @@ -54,6 +56,10 @@ setup-venv: ## setup a development virutalenv in current directory
if [ ! -d $(VENV) ]; then virtualenv $(VENV); exit; fi;
$(IN_VENV) pip install --upgrade pip && pip install -r requirements.txt && pip install -r dev-requirements.txt

setup-venv3: ## setup a development virutalenv in current directory
if [ ! -d $(VENV3) ]; then virtualenv -p python3 $(VENV3); exit; fi;
$(IN_VENV3) pip install --upgrade pip && pip install -r requirements.txt && pip install -r dev-requirements.txt

setup-git-hook-lint: ## setup precommit hook for linting project
cp $(BUILD_SCRIPTS_DIR)/pre-commit-lint .git/hooks/pre-commit

Expand Down
20 changes: 17 additions & 3 deletions planemo/tool_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,25 @@
class: CommandLineTool
id: "{{id}}"
label: "{{label}}"
{%- if containers %}
{%- if containers or requirements %}
hints:
{%- for container in containers %}
- class: DockerRequirement
DockerRequirement:
dockerPull: {{ container.image_id }}
{%- endfor %}
{%- if requirements %}
SoftwareRequirement:
packages:
{%- for requirement in requirements %}
- package: {{ requirement.name }}
{%- if requirement.version %}
version:
- "{{ requirement.version }}"
{%- else %}
version: []
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if inputs or outputs %}
inputs:
Expand Down Expand Up @@ -268,6 +281,7 @@ def _build_cwl(**kwds):
"cwl_version": DEFAULT_CWL_VERSION,
"help": kwds.get("help", ""),
"containers": kwds.get("containers", []),
"requirements": kwds.get("requirements", []),
"id": kwds.get("id"),
"label": kwds.get("name"),
}
Expand Down Expand Up @@ -641,7 +655,7 @@ def _handle_requirements(kwds):
"""
requirements = kwds["requirement"]
del kwds["requirement"]
requirements = map(Requirement, requirements or [])
requirements = list(map(Requirement, requirements or []))

container = kwds["container"]
del kwds["container"]
Expand Down