2020from .errors import WorkflowException
2121from .job import ContainerCommandLineJob
2222from .loghandler import _logger
23- from .pathmapper import PathMapper # pylint: disable=unused-import
23+ from .pathmapper import PathMapper , MapperEnt # pylint: disable=unused-import
2424from .pathmapper import ensure_writable , ensure_non_writable
2525from .secrets import SecretStore # pylint: disable=unused-import
2626from .utils import (DEFAULT_TMP_PREFIX , docker_windows_path_adjust , onWindows ,
@@ -219,7 +219,7 @@ def append_volume(runtime, source, target, writable=False):
219219 def add_file_or_directory_volume (self ,
220220 runtime , # type: List[Text]
221221 volume , # type: MapperEnt
222- host_outdir_tgt # type: Text
222+ host_outdir_tgt # type: Optional[ Text]
223223 ): # type: (...) -> None
224224 """Append volume a file/dir mapping to the runtime option list."""
225225 if not volume .resolved .startswith ("_:" ):
@@ -230,7 +230,7 @@ def add_file_or_directory_volume(self,
230230 def add_writable_file_volume (self ,
231231 runtime , # type: List[Text]
232232 volume , # type: MapperEnt
233- host_outdir_tgt # type: Text
233+ host_outdir_tgt # type: Optional[ Text]
234234 ): # type: (...) -> None
235235 """Append a writable file mapping to the runtime option list."""
236236 if self .inplace_update :
@@ -253,7 +253,7 @@ def add_writable_file_volume(self,
253253 def add_writable_directory_volume (self ,
254254 runtime , # type: List[Text]
255255 volume , # type: MapperEnt
256- host_outdir_tgt # type: Text
256+ host_outdir_tgt # type: Optional[ Text]
257257 ): # type: (...) -> None
258258 """Append a writable directory mapping to the runtime option list."""
259259 if volume .resolved .startswith ("_:" ):
@@ -273,19 +273,20 @@ def add_writable_directory_volume(self,
273273 else :
274274 if not host_outdir_tgt :
275275 tmpdir = tempfile .mkdtemp (dir = self .tmpdir )
276- host_outdir_tgt = os .path .join (
276+ new_dir = os .path .join (
277277 tmpdir , os .path .basename (volume .resolved ))
278- shutil .copytree (volume .resolved , host_outdir_tgt )
278+ shutil .copytree (volume .resolved , new_dir )
279279 self .append_volume (
280- runtime , host_outdir_tgt , volume .target ,
280+ runtime , new_dir , volume .target ,
281281 writable = True )
282282 else :
283283 shutil .copytree (volume .resolved , host_outdir_tgt )
284- ensure_writable (host_outdir_tgt )
284+ ensure_writable (host_outdir_tgt or new_dir )
285285
286286 def create_runtime (self , env , runtimeContext ):
287287 # type: (MutableMapping[Text, Text], RuntimeContext) -> List
288- any_path_okay = self .builder .get_requirement ("DockerRequirement" )[1 ]
288+ any_path_okay = self .builder .get_requirement ("DockerRequirement" )[1 ] \
289+ or False
289290 user_space_docker_cmd = runtimeContext .user_space_docker_cmd
290291 if user_space_docker_cmd :
291292 if 'udocker' in user_space_docker_cmd and not runtimeContext .debug :
0 commit comments