Skip to content

Commit 15092ba

Browse files
author
Peter Amstutz
committed
Merge branch 'master' into resource-requirement
2 parents 242e58c + 21a8461 commit 15092ba

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cwltool/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ def arg_parser():
100100
exgroup.add_argument("--version", action="store_true", help="Print version and exit")
101101
exgroup.add_argument("--update", action="store_true", help="Update to latest CWL version, print and exit")
102102

103-
parser.add_argument("--strict", action="store_true", help="Strict validation (error on unrecognized fields)")
103+
exgroup = parser.add_mutually_exclusive_group()
104+
exgroup.add_argument("--strict", action="store_true", help="Strict validation (unrecognized or out of place fields are error)",
105+
default=True, dest="strict")
106+
exgroup.add_argument("--non-strict", action="store_false", help="Lenient validation (ignore unrecognized fields)",
107+
default=True, dest="strict")
104108

105109
exgroup = parser.add_mutually_exclusive_group()
106110
exgroup.add_argument("--verbose", action="store_true", help="Default logging")

cwltool/update.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ def updateScript(sc):
9191
sc = sc.replace("$self", "self")
9292
return sc
9393

94-
def _draftDraft3dev1toDev2(doc):
94+
def _draftDraft3dev1toDev2(doc, loader, baseuri):
9595
# Convert expressions
9696
if isinstance(doc, dict):
97+
if "@import" in doc:
98+
r, _ = loader.resolve_ref(doc["@import"], base_url=baseuri)
99+
return _draftDraft3dev1toDev2(r, loader, r["id"])
100+
97101
for a in doc:
98102
ent = doc[a]
99103
if isinstance(ent, dict) and "engine" in ent:
@@ -118,7 +122,7 @@ def _draftDraft3dev1toDev2(doc):
118122
else:
119123
doc[a] = "$(%s)" % sc
120124
else:
121-
doc[a] = _draftDraft3dev1toDev2(doc[a])
125+
doc[a] = _draftDraft3dev1toDev2(doc[a], loader, baseuri)
122126

123127
if "class" in doc and (doc["class"] in ("CommandLineTool", "Workflow", "ExpressionTool")):
124128
added = False
@@ -139,12 +143,12 @@ def _draftDraft3dev1toDev2(doc):
139143
doc["requirements"].append({"class":"InlineJavascriptRequirement"})
140144

141145
elif isinstance(doc, list):
142-
return [_draftDraft3dev1toDev2(a) for a in doc]
146+
return [_draftDraft3dev1toDev2(a, loader, baseuri) for a in doc]
143147

144148
return doc
145149

146150
def draftDraft3dev1toDev2(doc, loader, baseuri):
147-
return (_draftDraft3dev1toDev2(doc), "https://w3id.org/cwl/cwl#draft-3.dev2")
151+
return (_draftDraft3dev1toDev2(doc, loader, baseuri), "https://w3id.org/cwl/cwl#draft-3.dev2")
148152

149153
def update(doc, loader, baseuri):
150154
updates = {

0 commit comments

Comments
 (0)