From 7196223e8ae1ccbdcc37a738f6e403d0f83ae022 Mon Sep 17 00:00:00 2001 From: Manvendra Singh Date: Wed, 2 Aug 2017 19:43:34 +0530 Subject: [PATCH] load_tool.py: Pass to regex before checking for acceptable versions --- cwltool/load_tool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cwltool/load_tool.py b/cwltool/load_tool.py index 38573a2ed..491fc3a2c 100644 --- a/cwltool/load_tool.py +++ b/cwltool/load_tool.py @@ -162,14 +162,15 @@ def validate_document(document_loader, # type: Loader if "cwlVersion" in workflowobj: if not isinstance(workflowobj["cwlVersion"], (str, Text)): raise Exception("'cwlVersion' must be a string, got %s" % type(workflowobj["cwlVersion"])) + # strip out version + workflowobj["cwlVersion"] = re.sub( + r"^(?:cwl:|https://w3id.org/cwl/cwl#)", "", + 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.sort() raise ValidationException("'cwlVersion' not valid. Supported CWL versions are: \n{}".format("\n".join(versions))) - workflowobj["cwlVersion"] = re.sub( - r"^(?:cwl:|https://w3id.org/cwl/cwl#)", "", - workflowobj["cwlVersion"]) else: raise ValidationException("No cwlVersion found." "Use the following syntax in your CWL workflow to declare version: cwlVersion: ")