From cf241cd80cc0896aa54bec9ac75e0c269c3ab0e3 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 22 Sep 2016 09:52:40 -0400 Subject: [PATCH] Propagate "listing" in scandeps (#197) * Propagate "listing" in scandeps * Add test for directory listing in scandeps. --- cwltool/process.py | 2 ++ tests/test_examples.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cwltool/process.py b/cwltool/process.py index 2b07affa9..b5d38fdce 100644 --- a/cwltool/process.py +++ b/cwltool/process.py @@ -652,6 +652,8 @@ def scandeps(base, doc, reffields, urlfields, loadref): "class": doc["class"], "location": urlparse.urljoin(base, u) } + if doc["class"] == "Directory" and "listing" in doc: + deps["listing"] = doc["listing"] deps = nestdir(base, deps) r.append(deps) diff --git a/tests/test_examples.py b/tests/test_examples.py index 8d7778d68..0f30875d2 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -131,7 +131,11 @@ def test_scandeps(self): "id": "file:///example/bar.cwl#input2", "default": { "class": "Directory", - "location": "file:///example/data2" + "location": "file:///example/data2", + "listing": [{ + "class": "File", + "location": "file:///example/data3.txt" + }] } }] } @@ -165,7 +169,17 @@ def loadref(base, p): { "basename": "data2", "class": "Directory", - "location": "file:///example/data2" + "location": "file:///example/data2", + "listing": [{ + "basename": "data3.txt", + "class": "File", + "location": "file:///example/data3.txt" + }] + }, + { + "basename": "data3.txt", + "class": "File", + "location": "file:///example/data3.txt" }], sc) sc = cwltool.process.scandeps(obj["id"], obj,