Skip to content

remove draft-2 and draft-3 support #520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 25, 2018
Merged
700 changes: 700 additions & 0 deletions cwltool/command_line_tool.py

Large diffs are not rendered by default.

703 changes: 4 additions & 699 deletions cwltool/draft2tool.py

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions cwltool/load_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ def validate_document(document_loader, # type: Loader
if metadata and 'cwlVersion' in metadata:
workflowobj['cwlVersion'] = metadata['cwlVersion']
else:
raise ValidationException("No cwlVersion found."
"Use the following syntax in your CWL document to declare "
"the version: cwlVersion: <version>")
raise ValidationException(
"No cwlVersion found. "
"Use the following syntax in your CWL document to declare the version: cwlVersion: <version>.\n"
"Note: if this is a CWL draft-2 (pre v1.0) document then it will need to be upgraded first.")

if not isinstance(workflowobj["cwlVersion"], (str, Text)):
raise Exception("'cwlVersion' must be a string, got %s" % type(workflowobj["cwlVersion"]))
Expand All @@ -230,16 +231,14 @@ def validate_document(document_loader, # type: Loader
workflowobj["cwlVersion"])
if workflowobj["cwlVersion"] not in list(ALLUPDATES):
# print out all the Supported Versions of cwlVersion
versions = list(ALLUPDATES) # ALLUPDATES is a dict
versions = []
for version in list(ALLUPDATES):
if "dev" in version:
version += " (with --enable-dev flag only)"
versions.append(version)
versions.sort()
raise ValidationException("'cwlVersion' not valid. Supported CWL versions are: \n{}".format("\n".join(versions)))

if workflowobj["cwlVersion"] == "draft-2":
workflowobj = cast(CommentedMap, cmap(update._draft2toDraft3dev1(
workflowobj, document_loader, uri, update_steps=False)))
if "@graph" in workflowobj:
workflowobj["$graph"] = workflowobj["@graph"]
del workflowobj["@graph"]
raise ValidationException("The CWL reference runner no longer supports pre CWL v1.0 documents. "
"Supported versions are: \n{}".format("\n".join(versions)))

(sch_document_loader, avsc_names) = \
process.get_schema(workflowobj["cwlVersion"])[:2]
Expand All @@ -260,8 +259,6 @@ def validate_document(document_loader, # type: Loader
raise ValidationException("Workflow must be a dict or list.")

if not new_metadata:
if not isinstance(processobj, dict):
raise ValidationException("Draft-2 workflows must be a dict.")
new_metadata = cast(CommentedMap, cmap(
{"$namespaces": processobj.get("$namespaces", {}),
"$schemas": processobj.get("$schemas", []),
Expand Down
4 changes: 2 additions & 2 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from schema_salad.ref_resolver import Loader, file_uri, uri_file_path
from schema_salad.sourceline import strip_dup_lineno

from . import draft2tool, workflow
from . import command_line_tool, workflow
from .argparser import arg_parser, generate_parser, DEFAULT_TMP_PREFIX
from .cwlrdf import printdot, printrdf
from .errors import UnsupportedRequirement, WorkflowException
Expand Down Expand Up @@ -418,7 +418,7 @@ def main(argsl=None, # type: List[str]
arg_parser().print_help()
return 1
if args.relax_path_checks:
draft2tool.ACCEPTLIST_RE = draft2tool.ACCEPTLIST_EN_RELAXED_RE
command_line_tool.ACCEPTLIST_RE = command_line_tool.ACCEPTLIST_EN_RELAXED_RE

if args.ga4gh_tool_registries:
ga4gh_tool_registries[:] = args.ga4gh_tool_registries
Expand Down
Loading