Skip to content

Commit e3cb068

Browse files
committed
skip non-draft3 CWL documents
1 parent ae3d167 commit e3cb068

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MODULE=cwl-upgrader
2626
# `SHELL=bash` Will break Titus's laptop, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29-
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257
29+
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 flake8
3030
MYPYPATH=typeshed/2or3
3131
MYPYFLAGS=--disallow-untyped-calls --disallow-untyped-defs \
3232
--warn-incomplete-stub --warn-redundant-casts
@@ -45,7 +45,7 @@ install-dep: install-dependencies
4545

4646
install-dependencies:
4747
pip install --upgrade $(DEVPKGS)
48-
pip install -r requirements.txt
48+
#pip install -r requirements.txt
4949

5050
## install : install the ${MODULE} module and schema-salad-tool
5151
install: FORCE

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Common workflow language standalone document upgrader
55
This is a standalone upgrader for Common Workflow Language documents from
66
version "draft-3" to "v1.0".
77

8+
It does not check for correctness of the input document, for that one can use
9+
the CWL reference implementation.
10+
811
This is written and tested for Python 2.7, 3.4, and 3.5.
912

1013
Install

cwlupgrader/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ def main(): # type: () -> int
1111
for path in sys.argv[1:]:
1212
with open(path) as entry:
1313
document = ruamel.yaml.round_trip_load(entry)
14-
draft3_to_v1_0(document)
14+
if ('cwlVersion' in document
15+
and document['cwlVersion'] == 'cwl:draft-3'):
16+
draft3_to_v1_0(document)
17+
else:
18+
print("Skipping non draft-3 CWL document", file=sys.stderr)
1519
print(ruamel.yaml.round_trip_dump(document))
1620
return 0
1721

@@ -45,7 +49,7 @@ def _draft3_to_v1_0(document):
4549
for i, sf in enumerate(document["secondaryFiles"]):
4650
if "$(" in sf or "${" in sf:
4751
document["secondaryFiles"][i] = sf.replace(
48-
'"path"', '"location"').replace(".path", ".location")
52+
'"path"', '"location"').replace(".path", ".location")
4953

5054
if "description" in document:
5155
document["doc"] = document["description"]
@@ -92,4 +96,3 @@ def shortenType(typeObj):
9296

9397
if __name__ == "__main__":
9498
sys.exit(main())
95-

0 commit comments

Comments
 (0)