mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
update to cope with impending changes to cwltool internals
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user