Skip to content

Commit

Permalink
Infrastructure for parsing CWL tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jan 3, 2016
1 parent a9d4783 commit 2054f53
Show file tree
Hide file tree
Showing 7 changed files with 736 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/galaxy/tools/cwl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from .parser import tool_proxy
from .runtime_actions import handle_outputs
from .representation import to_cwl_job, to_galaxy_parameters

from .cwltool_deps import (
needs_shell_quoting,
shellescape,
)


__all__ = [
'tool_proxy',
'handle_outputs',
'to_cwl_job',
'to_galaxy_parameters',
'needs_shell_quoting',
'shellescape',
]
48 changes: 48 additions & 0 deletions lib/galaxy/tools/cwl/cwltool_deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
""" This module contains logic for dealing with cwltool as an optional
dependency for Galaxy and/or applications which use Galaxy as a library.
"""

try:
import requests
except ImportError:
requests = None

try:
from cwltool import (
main,
workflow,
job,
)
except ImportError:
main = None
workflow = None
job = None

try:
import shellescape
except ImportError:
shellescape = None

if job is not None:
needs_shell_quoting = job.needs_shell_quoting
else:
needs_shell_quoting = None


def ensure_cwltool_available():
if main is None or workflow is None or shellescape is None:
message = "This feature requires cwltool and dependencies to be available, they are not."
if requests is None:
message += " Library 'requests' unavailable."
if shellescape is None:
message += " Library 'shellescape' unavailable."
raise ImportError(message)


__all__ = [
'main',
'workflow',
'ensure_cwltool_available',
'shellescape',
'needs_shell_quoting',
]
Loading

0 comments on commit 2054f53

Please sign in to comment.