Skip to content

Commit d007cf6

Browse files
authored
Merge pull request #121 from common-workflow-language/fsaccess-join
Add path join to fsaccess abstraction.
2 parents 445c18d + 3a6fa17 commit d007cf6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cwltool/draft2tool.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .pathmapper import PathMapper
2525
from .job import CommandLineJob
2626

27-
ACCEPTLIST_RE = re.compile(r"^[a-zA-Z0-9._-]+$")
27+
ACCEPTLIST_RE = re.compile(r"^[a-zA-Z0-9._+-]+$")
2828

2929
from .flatten import flatten
3030

@@ -92,7 +92,7 @@ def revmap_file(builder, outdir, f):
9292
f["location"] = revmap_f[1]
9393
return f
9494
elif f["path"].startswith(builder.outdir):
95-
f["location"] = os.path.join(outdir, f["path"][len(builder.outdir)+1:])
95+
f["location"] = builder.fs_access.join(outdir, f["path"][len(builder.outdir)+1:])
9696
return f
9797
else:
9898
raise WorkflowException(u"Output file path %s must be within designated output directory (%s) or an input file pass through." % (f["path"], builder.outdir))
@@ -344,7 +344,7 @@ def collect_output_ports(self, ports, builder, outdir):
344344
# type: (Set[Dict[str,Any]], Builder, str) -> Dict[unicode, Union[unicode, List[Any], Dict[unicode, Any]]]
345345
try:
346346
ret = {} # type: Dict[unicode, Union[unicode, List[Any], Dict[unicode, Any]]]
347-
custom_output = os.path.join(outdir, "cwl.output.json")
347+
custom_output = builder.fs_access.join(outdir, "cwl.output.json")
348348
if builder.fs_access.exists(custom_output):
349349
with builder.fs_access.open(custom_output, "r") as f:
350350
ret = json.load(f)
@@ -400,7 +400,7 @@ def collect_output(self, schema, builder, outdir):
400400
try:
401401
r.extend([{"location": g,
402402
"class": "File" if builder.fs_access.isfile(g) else "Directory"}
403-
for g in builder.fs_access.glob(os.path.join(outdir, gb))])
403+
for g in builder.fs_access.glob(builder.fs_access.join(outdir, gb))])
404404
except (OSError, IOError) as e:
405405
_logger.warn(str(e))
406406

cwltool/stdfsaccess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ def isdir(self, fn): # type: (unicode) -> bool
2929

3030
def listdir(self, fn): # type: (unicode) -> List[unicode]
3131
return [abspath(l, fn) for l in os.listdir(self._abs(fn))]
32+
33+
def join(self, path, *paths): # type: (unicode, *unicode) -> unicode
34+
return os.path.join(path, *paths)

0 commit comments

Comments
 (0)