Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Mar 11, 2021
1 parent 22e3d48 commit c86a522
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cwltool/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ def append_volume(
runtime: List[str], source: str, target: str, writable: bool = False
) -> None:
"""Add binding arguments to the runtime list."""
if os.path.isfile(source) and target.endswith(os.path.basename(source)) and not writable:
if (
os.path.isfile(source)
and target.endswith(os.path.basename(source))
and not writable
):
source = os.path.dirname(source)
target = os.path.dirname(target)
options = [
Expand Down
11 changes: 8 additions & 3 deletions cwltool/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,16 @@ def get_from_requirements(

@staticmethod
def append_volume(
runtime: List[str], source: str, target: str, writable: bool = False
runtime: List[str], source: str, target: str, writable: bool = False
) -> None:
src = docker_windows_path_adjust(source)
dst = docker_windows_path_adjust(target)
writable = "rw" if writable else "ro"
if os.path.isfile(src) and dst.endswith(os.path.basename(src)) and writable == 'ro':
if (
os.path.isfile(src)
and dst.endswith(os.path.basename(src))
and writable == "ro"
):
src = os.path.dirname(src)
dst = os.path.dirname(dst)
bind_arg = f"--bind={src}:{dst}:{writable}"
Expand Down Expand Up @@ -404,7 +408,8 @@ def create_runtime(
)
)
else:
runtime.append("--bind={}:{}:rw".format(
runtime.append(
"--bind={}:{}:rw".format(
docker_windows_path_adjust(os.path.realpath(self.outdir)),
self.builder.outdir,
)
Expand Down

0 comments on commit c86a522

Please sign in to comment.