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
2 changes: 1 addition & 1 deletion .github/workflows/mulled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [2.7, 3.7]
python-version: [3.7]
steps:
- name: Cache tox dir
uses: actions/cache@v1
Expand Down
39 changes: 18 additions & 21 deletions lib/galaxy/config/config_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def main(argv=None):
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
app_name = args.app
app_desc = APPS.get(app_name, None)
app_desc = APPS.get(app_name)
action = args.action
action_func = ACTIONS[action]
action_func(args, app_desc)
Expand Down Expand Up @@ -520,32 +520,29 @@ def _lint(args, app_desc):


def _validate(args, app_desc):
if Core is None:
raise Exception("Cannot validate file, pykwalify is not installed.")
path = _find_config(args, app_desc)
# Allow empty mapping (not allowed by pykawlify)
# Allow empty mapping (not allowed by pykwalify)
raw_config = _order_load_path(path)
if raw_config.get(app_desc.app_name, None) is None:
if raw_config.get(app_desc.app_name) is None:
raw_config[app_desc.app_name] = {}
config_p = tempfile.NamedTemporaryFile('w', delete=False, suffix=".yml")
# Rewrite the file any way to merge any duplicate keys
with tempfile.NamedTemporaryFile('w', delete=False, suffix=".yml") as config_p:
ordered_dump(raw_config, config_p)
config_p.flush()
path = config_p.name

fp = tempfile.NamedTemporaryFile('w', delete=False, suffix=".yml")

def _clean(p, k, v):
return k not in ['reloadable', 'path_resolves_to']

clean_schema = remap(app_desc.schema.raw_schema, _clean)
ordered_dump(clean_schema, fp)
fp.flush()
name = fp.name
if Core is None:
raise Exception("Cannot validate file, pykwalify is not installed.")
c = Core(
source_file=path,
schema_files=[name],
)
c.validate()
with tempfile.NamedTemporaryFile('w', suffix=".yml") as fp:
ordered_dump(clean_schema, fp)
c = Core(
source_file=config_p.name,
schema_files=[fp.name],
)
c.validate()
os.remove(config_p.name)


class PrefixFilter(object):
Expand Down Expand Up @@ -713,8 +710,8 @@ def _write_to_file(args, f, path):
def _order_load_path(path):
"""Load (with ``_ordered_load``) on specified path (a YAML file)."""
with open(path, "r") as f:
# Allow empty mapping (not allowed by pykawlify)
raw_config = ordered_load(f)
# Allow empty mapping (not allowed by pykwalify)
raw_config = ordered_load(f, merge_duplicate_keys=True)
return raw_config


Expand All @@ -724,7 +721,7 @@ def _write_sample_section(args, f, section_header, schema, as_comment=True, uwsg
default = None if "default" not in value else value["default"]
option = schema.get_app_option(key)
option_value = OptionValue(key, default, option)
# support uWSGI "dumb yaml parser" (unbit/uwsgi#863)
# support uWSGI "dumb YAML parser" (unbit/uwsgi#863)
key = option.get('key', key)
_write_option(args, f, key, option_value, as_comment=as_comment, uwsgi_hack=uwsgi_hack)

Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/pipfiles/default/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pyuwsgi = "*"
pysam = "==0.15.2"
bdbag = "*"
bleach = "*"
cwltool = "==1.0.20180721142728"
cwltool = "==1.0.20191225192155"
"bz2file" = {version = "*", markers = "python_version < '3.3'"}
ipaddress = {version = "*", markers = "python_version < '3.3'"}
isa-rwval = "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ more-itertools==5.0.0
nose==1.3.7
nosehtml==0.4.5
packaging==20.0
pathlib2==2.3.2 ; python_version < '3.6'
pathlib2==2.3.5 ; python_version < '3.6'
pathtools==0.1.2
pluggy==0.13.1
port-for==0.4
Expand Down
12 changes: 7 additions & 5 deletions lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ adal==1.2.2
amqp==2.5.2
appdirs==1.4.3
attrs==19.3.0
avro==1.8.1 ; python_version < '3'
azure-common==1.1.14
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.4
Expand Down Expand Up @@ -41,10 +40,11 @@ cliff==2.17.0
cloudauthz==0.6.0
cloudbridge==2.0.0
cmd2==0.8.9
coloredlogs==10.0
configparser==4.0.2 ; python_version < '3.2'
contextlib2==0.6.0.post1 ; python_version < '3.5'
cryptography==2.8
cwltool==1.0.20180721142728
cwltool==1.0.20191225192155
debtcollector==1.22.0
decorator==4.4.1
deprecated==1.2.7
Expand All @@ -66,6 +66,7 @@ google-auth==1.10.0
gxformat2==0.10.1
h5py==2.10.0
httplib2==0.15.0
humanfriendly==4.18
idna==2.8
importlib-metadata==1.3.0 ; python_version < '3.8'
ipaddress==1.0.23 ; python_version < '3.3'
Expand Down Expand Up @@ -116,7 +117,7 @@ parsley==1.3
paste==3.2.4
pastedeploy==2.0.1
pastescript==3.2.0
pathlib2==2.3.2 ; python_version < '3.6'
pathlib2==2.3.5 ; python_version < '3.6'
pbr==5.4.4
prettytable==0.7.2
prov==1.5.1
Expand Down Expand Up @@ -161,10 +162,11 @@ rfc3986==1.3.2
routes==2.4.1
rsa==4.0
ruamel.ordereddict==0.4.14 ; platform_python_implementation == 'CPython' and python_version <= '2.7'
ruamel.yaml==0.15.100
ruamel.yaml.clib==0.2.0 ; platform_python_implementation == 'CPython' and python_version < '3.8'
ruamel.yaml==0.16.0
s3transfer==0.2.1
scandir==1.10.0 ; python_version < '3.5'
schema-salad==2.7.20181126142424
schema-salad==4.5.20191229160203
setuptools-scm==3.3.3
shellescape==3.4.1
simplejson==3.17.0
Expand Down
63 changes: 47 additions & 16 deletions lib/galaxy/tool_util/cwl/cwltool_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
functionality at runtime.
"""
import re
import warnings

warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", module="cwltool")

try:
import requests
Expand All @@ -19,23 +22,44 @@
process,
pathmapper,
)
except (ImportError, SyntaxError):
# Drop SyntaxError once cwltool supports Python 3
except ImportError:
main = None
workflow = None
job = None
process = None
pathmapper = None

try:
from cwltool.context import LoadingContext # Introduced in cwltool 1.0.20180615183820
except (ImportError, SyntaxError):
from cwltool.context import (
getdefault,
LoadingContext,
RuntimeContext,
)
from cwltool.job import relink_initialworkdir
from cwltool.stdfsaccess import StdFsAccess
except ImportError:
getdefault = None
LoadingContext = None
relink_initialworkdir = None
RuntimeContext = None
StdFsAccess = None

try:
from cwltool import load_tool
except (ImportError, SyntaxError):
from cwltool.load_tool import (
default_loader,
resolve_and_validate_document,
)
except ImportError:
default_loader = None
load_tool = None
resolve_and_validate_document = None

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

try:
import shellescape
Expand All @@ -44,18 +68,19 @@

try:
import schema_salad
except (ImportError, SyntaxError):
# Drop SyntaxError once schema_salad supports Python 3
except ImportError:
schema_salad = None

try:
from schema_salad import ref_resolver
except (ImportError, SyntaxError):
ref_resolver = None


needs_shell_quoting = re.compile(r"""(^$|[\s|&;()<>\'"$@])""").search

# if set to True, file format checking is not performed.
beta_relaxed_fmt_check = True


def ensure_cwltool_available():
"""Assert optional dependencies proxied via this module are available at runtime.
Expand All @@ -66,8 +91,8 @@ def ensure_cwltool_available():
message = "This feature requires cwltool and dependencies to be available, they are not."
if main is None:
message += " cwltool is not unavailable."
elif load_tool is None:
message += " cwltool.load_tool is unavailable - cwltool version is too old."
elif resolve_and_validate_document is None:
message += " cwltool.load_tool.resolve_and_validate_document is unavailable - cwltool version is too old."
if requests is None:
message += " Library 'requests' unavailable."
if shellescape is None:
Expand All @@ -78,15 +103,21 @@ def ensure_cwltool_available():


__all__ = (
'main',
'ref_resolver',
'default_loader',
'ensure_cwltool_available',
'getdefault',
'load_tool',
'LoadingContext',
'workflow',
'process',
'main',
'needs_shell_quoting',
'pathmapper',
'ensure_cwltool_available',
'process',
'ref_resolver',
'relink_initialworkdir',
'resolve_and_validate_document',
'RuntimeContext',
'schema_salad',
'shellescape',
'needs_shell_quoting',
'StdFsAccess',
'workflow',
)
Loading