update to cope with impending changes to cwltool internals

This commit is contained in:
Rupert Nash
2021-03-19 16:28:34 +00:00
committed by Nicola Soranzo
parent 50eaca7b3f
commit 14fe8188b8
2 changed files with 21 additions and 7 deletions
+18 -7
View File
@@ -52,9 +52,26 @@ except ImportError:
load_tool = None # type: ignore
resolve_and_validate_document = None # type: ignore
def _has_relax_path_checks_flag():
"""Return True if cwltool uses a flag to control path checks.
Old cwltool uses the module global below to control whether
it's strict about path checks. New versions use an attribute
of LoadingContext.
Once the version of cwltool required is new enough, we can remove
this function and simplify the conditionals where it's used.
"""
lc = LoadingContext()
return hasattr(lc, "relax_path_checks")
try:
from cwltool import command_line_tool
command_line_tool.ACCEPTLIST_RE = command_line_tool.ACCEPTLIST_EN_RELAXED_RE
if not _has_relax_path_checks_flag():
command_line_tool.ACCEPTLIST_RE = command_line_tool.ACCEPTLIST_EN_RELAXED_RE
except ImportError:
command_line_tool = None # type: ignore
@@ -63,12 +80,6 @@ try:
except ImportError:
resolve_and_validate_document = None # type: ignore
try:
from cwltool import command_line_tool
command_line_tool.ACCEPTLIST_RE = command_line_tool.ACCEPTLIST_EN_RELAXED_RE
except ImportError:
command_line_tool = None # type: ignore
try:
import shellescape
except ImportError:
+3
View File
@@ -4,6 +4,7 @@ import tempfile
from collections import namedtuple
from .cwltool_deps import (
_has_relax_path_checks_flag,
default_loader,
ensure_cwltool_available,
load_tool,
@@ -33,6 +34,8 @@ class SchemaLoader:
loading_context.do_validate = self._validate
loading_context.loader = self.raw_document_loader
loading_context.do_update = True
if _has_relax_path_checks_flag():
loading_context.relax_path_checks = True
return loading_context
def raw_process_reference(self, path, loading_context=None):