Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ include tests/tmp4/alpha/*
include tests/wf/*
include tests/wf/operation/*
include tests/override/*
include tests/reloc/*.cwl
include tests/reloc/dir1/*
include tests/reloc/dir2/*
include tests/checker_wf/*
include tests/subgraph/*
include tests/trs/*
Expand Down
4 changes: 3 additions & 1 deletion cwltool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,13 @@ def _collectDirEntries(
yield from _collectDirEntries(sub_obj)

def _relocate(src: str, dst: str) -> None:
src = fs_access.realpath(src)
dst = fs_access.realpath(dst)

if src == dst:
return

# If the source is not contained in source_directories we're not allowed to delete it
src = fs_access.realpath(src)
src_can_deleted = any(
os.path.commonprefix([p, src]) == p for p in source_directories
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ requests>=2.4.3
ruamel.yaml>=0.15,<0.17.17
rdflib>=4.2.2,<6.1
shellescape>=3.4.1,<3.9
schema-salad>=8.2.20210914115719,<9
schema-salad>=8.2.20211104054942,<9
prov==1.5.1
bagit==1.8.1
mypy-extensions
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@
"ruamel.yaml >= 0.15, < 0.17.17",
"rdflib >= 4.2.2, < 6.1.0",
"shellescape >= 3.4.1, < 3.9",
# 7.1.20210518142926 or later required due to
# https://github.com/common-workflow-language/schema_salad/issues/385
"schema-salad >= 8.2.20210914115719, < 9",
"schema-salad >= 8.2.20211104054942, < 9",
"mypy-extensions",
"psutil >= 5.6.6",
"prov == 1.5.1",
Expand Down
Empty file added tests/reloc/dir1/foo
Empty file.
1 change: 1 addition & 0 deletions tests/reloc/dir2
15 changes: 15 additions & 0 deletions tests/reloc/test.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cwlVersion: v1.2
class: CommandLineTool
inputs:
inp: Directory
outputs:
bar:
type: File
outputBinding:
glob: dir2/foo
requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing:
- $(inputs.inp)
arguments: [ls, -l]
20 changes: 20 additions & 0 deletions tests/test_relocate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import json
import sys
from pathlib import Path
import tempfile

from cwltool.main import main
from cwltool.process import relocateOutputs
from cwltool.stdfsaccess import StdFsAccess
from cwltool.pathmapper import PathMapper

from .util import get_data, needs_docker

Expand Down Expand Up @@ -33,3 +37,19 @@ def test_for_conflict_file_names(tmp_path: Path) -> None:
out = json.loads(stream.getvalue())
assert out["b1"]["basename"] == out["b2"]["basename"]
assert out["b1"]["location"] != out["b2"]["location"]


def test_relocate_symlinks(tmp_path: Path) -> None:
assert (
main(
[
"--debug",
"--outdir",
get_data("tests/reloc") + "/dir2",
get_data("tests/reloc/test.cwl"),
"--inp",
get_data("tests/reloc") + "/dir2",
]
)
== 0
)