We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Replace galaxy-lib requirement with galaxy-tool-util
I'm working on Planemo to replace its dependency on galaxy-lib (which will be basically deprecated with Galaxy release 19.09) with [galaxy-tool-util](https://pypi.org/project/galaxy-tool-util/). Unfortunately CWL support in Planemo via cwltool would break unless also cwltool moves to galaxy-tool-util.

I can do the necessary changes in cwltool when I'm back from holidays, in the mean time I wanted to check that's fine with you all.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cwltool/software_requirements.py`
Content:
```
1 """This module handles resolution of SoftwareRequirement hints.
2 
3 This is accomplished mainly by adapting cwltool internals to galaxy-lib's
4 concept of "dependencies". Despite the name, galaxy-lib is a light weight
5 library that can be used to map SoftwareRequirements in all sorts of ways -
6 Homebrew, Conda, custom scripts, environment modules. We'd be happy to find
7 ways to adapt new packages managers and such as well.
8 """
9 from __future__ import absolute_import
10 
11 import argparse  # pylint: disable=unused-import
12 import os
13 import string
14 from typing import Dict, List, MutableSequence, Optional
15 
16 from typing_extensions import Text  # pylint: disable=unused-import
17 # move to a regular typing import when Python 3.3-3.6 is no longer supported
18 
19 from .builder import Builder, HasReqsHints
20 try:
21     from galaxy.tools.deps.requirements import ToolRequirement, ToolRequirements
22     from galaxy.tools import deps
23 except ImportError:
24     ToolRequirement = None  # type: ignore
25     ToolRequirements = None  # type: ignore
26     deps = None  # type: ignore
27 
28 
29 SOFTWARE_REQUIREMENTS_ENABLED = deps is not None
30 
31 COMMAND_WITH_DEPENDENCIES_TEMPLATE = string.Template("""#!/bin/bash
32 $handle_dependencies
33 python "run_job.py" "job.json"
34 """)
35 
36 
37 class DependenciesConfiguration(object):
38 
39     def __init__(self, args):
40         # type: (argparse.Namespace) -> None
41         """Initialize."""
42         conf_file = getattr(args, "beta_dependency_resolvers_configuration", None)
43         tool_dependency_dir = getattr(args, "beta_dependencies_directory", None)
44         conda_dependencies = getattr(args, "beta_conda_dependencies", None)
45         if conf_file is not None and os.path.exists(conf_file):
46             self.use_tool_dependencies = True
47             if tool_dependency_dir is None:
48                 tool_dependency_dir = os.path.abspath(os.path.dirname(conf_file))
49             self.tool_dependency_dir = tool_dependency_dir
50             self.dependency_resolvers_config_file = os.path.abspath(conf_file)
51         elif conda_dependencies is not None:
52             if not tool_dependency_dir is not None:
53                 tool_dependency_dir = os.path.abspath("./cwltool_deps")
54             self.tool_dependency_dir = tool_dependency_dir
55             self.use_tool_dependencies = True
56             self.dependency_resolvers_config_file = None
57         else:
58             self.use_tool_dependencies = False
59 
60     @property
61     def config_dict(self):  # type: () -> Dict[Text, bool]
62         return {
63             'conda_auto_install': True,
64             'conda_auto_init': True,
65         }
66 
67     def build_job_script(self, builder, command):
68         # type: (Builder, List[str]) -> Text
69         ensure_galaxy_lib_available()
70         tool_dependency_manager = deps.build_dependency_manager(self)  # type: deps.DependencyManager
71         dependencies = get_dependencies(builder)
72         handle_dependencies = ""  # str
73         if dependencies:
74             handle_dependencies = "\n".join(
75                 tool_dependency_manager.dependency_shell_commands(
76                     dependencies, job_directory=builder.tmpdir))
77 
78         template_kwds = dict(handle_dependencies=handle_dependencies)  # type: Dict[str, str]
79         job_script = COMMAND_WITH_DEPENDENCIES_TEMPLATE.substitute(template_kwds)
80         return job_script
81 
82 
83 def get_dependencies(builder):  # type: (HasReqsHints) -> ToolRequirements
84     (software_requirement, _) = builder.get_requirement("SoftwareRequirement")
85     dependencies = []  # type: List[ToolRequirement]
86     if software_requirement and software_requirement.get("packages"):
87         packages = software_requirement.get("packages")
88         for package in packages:
89             version = package.get("version", None)
90             if isinstance(version, MutableSequence):
91                 if version:
92                     version = version[0]
93                 else:
94                     version = None
95             specs = [{"uri": s} for s in package.get("specs", [])]
96             dependencies.append(ToolRequirement.from_dict(dict(
97                 name=package["package"].split("#")[-1],
98                 version=version,
99                 type="package",
100                 specs=specs,
101             )))
102 
103     return ToolRequirements.from_list(dependencies)
104 
105 
106 def get_container_from_software_requirements(use_biocontainers, builder):
107     # type: (bool, HasReqsHints) -> Optional[Text]
108     if use_biocontainers:
109         ensure_galaxy_lib_available()
110         from galaxy.tools.deps.containers import ContainerRegistry, AppInfo, ToolInfo, DOCKER_CONTAINER_TYPE
111         app_info = AppInfo(
112             involucro_auto_init=True,
113             enable_beta_mulled_containers=True,
114             container_image_cache_path=".",
115         )  # type: AppInfo
116         container_registry = ContainerRegistry(app_info)  # type: ContainerRegistry
117         requirements = get_dependencies(builder)
118         tool_info = ToolInfo(requirements=requirements)  # type: ToolInfo
119         container_description = container_registry.find_best_container_description([DOCKER_CONTAINER_TYPE], tool_info)
120         if container_description:
121             return container_description.identifier
122 
123     return None
124 
125 
126 def ensure_galaxy_lib_available():
127     # type: () -> None
128     if not SOFTWARE_REQUIREMENTS_ENABLED:
129         raise Exception("Optional Python library galaxy-lib not available, it is required for this configuration.")
130
```

Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 """Setup for the reference implementation of the CWL standards."""
3 from __future__ import print_function
4 import os
5 import sys
6 
7 import setuptools.command.egg_info as egg_info_cmd
8 from setuptools import setup
9 
10 SETUP_DIR = os.path.dirname(__file__)
11 README = os.path.join(SETUP_DIR, 'README.rst')
12 
13 try:
14     import gittaggers
15 
16     Tagger = gittaggers.EggInfoFromGit
17 except ImportError:
18     Tagger = egg_info_cmd.egg_info
19 
20 NEEDS_PYTEST = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
21 PYTEST_RUNNER = ['pytest-runner', 'pytest-cov'] if NEEDS_PYTEST else []
22 
23 if sys.version_info < (3, 0):
24     print("""
25 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
26 Please upgrade your Python as the Python 2.7 version of cwltool won't be
27 maintained after that date.
28 """, file=sys.stderr)
29 
30 setup(name='cwltool',
31       version='1.0',
32       description='Common workflow language reference implementation',
33       long_description=open(README).read(),
34       long_description_content_type="text/x-rst",
35       author='Common workflow language working group',
36       author_email='common-workflow-language@googlegroups.com',
37       url="https://github.com/common-workflow-language/cwltool",
38       download_url="https://github.com/common-workflow-language/cwltool",
39       # platforms='',  # empty as is conveyed by the classifier below
40       # license='',  # empty as is conveyed by the classifier below
41       packages=["cwltool", 'cwltool.tests'],
42       package_dir={'cwltool.tests': 'tests'},
43       package_data={'cwltool': [
44           'schemas/v1.0/*.yml',
45           'schemas/v1.0/*.md',
46           'schemas/v1.0/salad/schema_salad/metaschema/*.yml',
47           'schemas/v1.0/salad/schema_salad/metaschema/*.md',
48           'schemas/v1.1.0-dev1/*.yml',
49           'schemas/v1.1.0-dev1/*.md',
50           'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.yml',
51           'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.md',
52           'schemas/v1.1/*.yml',
53           'schemas/v1.1/*.md',
54           'schemas/v1.1/salad/schema_salad/metaschema/*.yml',
55           'schemas/v1.1/salad/schema_salad/metaschema/*.md',
56           'cwlNodeEngine.js',
57           'cwlNodeEngineJSConsole.js',
58           'extensions.yml',
59           'hello.simg']},
60       include_package_data=True,
61       install_requires=[
62           'setuptools',
63           'requests >= 2.6.1',  # >= 2.6.1 to workaround
64           # https://github.com/ionrock/cachecontrol/issues/137
65           'ruamel.yaml >= 0.12.4, <= 0.16',
66           'rdflib >= 4.2.2, < 4.3.0',
67           'shellescape >= 3.4.1, < 3.5',
68           'schema-salad >= 4.5, < 5',
69           'mypy-extensions',
70           'six >= 1.9.0',  # >= 1.9.0 required by prov
71           'psutil',
72           'scandir',
73           'prov == 1.5.1',
74           'bagit >= 1.6.4',
75           'typing-extensions',
76           'coloredlogs',
77           'future >= 0.16',
78           'pathlib2 != 2.3.1'
79       ],
80       extras_require={
81           ':os.name=="posix" and python_version<"3.5"': ['subprocess32 >= 3.5.0'],
82           ':python_version<"3.6"': ['typing >= 3.5.3'],
83           'deps': ["galaxy-lib >= 17.09.9, <= 18.9.2 "],
84           'docs': ["sphinx >= 2.2", "sphinx-rtd-theme"],
85       },
86       python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
87       setup_requires=PYTEST_RUNNER,
88       test_suite='tests',
89       tests_require=['pytest < 4.3.0', 'mock >= 2.0.0', 'pytest-mock >= 1.10.0',
90                      'arcp >= 0.2.0', 'rdflib-jsonld >= 0.4.0'],
91       entry_points={
92           'console_scripts': ["cwltool=cwltool.main:run"]
93       },
94       zip_safe=True,
95       cmdclass={'egg_info': Tagger},
96       classifiers=[
97           'Development Status :: 5 - Production/Stable',
98           'Environment :: Console',
99           'Intended Audience :: Developers',
100           'Intended Audience :: Science/Research',
101           'Intended Audience :: Healthcare Industry',
102           'License :: OSI Approved :: Apache Software License',
103           'Natural Language :: English',
104           'Operating System :: MacOS :: MacOS X',
105           'Operating System :: POSIX',
106           'Operating System :: POSIX :: Linux',
107           'Operating System :: OS Independent',
108           'Operating System :: Microsoft :: Windows',
109           'Operating System :: Microsoft :: Windows :: Windows 10',
110           'Operating System :: Microsoft :: Windows :: Windows 8.1',
111           # 'Operating System :: Microsoft :: Windows :: Windows 8',  # not tested
112           # 'Operating System :: Microsoft :: Windows :: Windows 7',  # not tested
113           'Programming Language :: Python :: 2',
114           'Programming Language :: Python :: 2.7',
115           'Programming Language :: Python :: 3',
116           'Programming Language :: Python :: 3.5',
117           'Programming Language :: Python :: 3.6',
118           'Programming Language :: Python :: 3.7',
119           'Programming Language :: Python :: 3.8',
120           'Topic :: Scientific/Engineering',
121           'Topic :: Scientific/Engineering :: Bio-Informatics',
122           'Topic :: Scientific/Engineering :: Astronomy',
123           'Topic :: Scientific/Engineering :: Atmospheric Science',
124           'Topic :: Scientific/Engineering :: Information Analysis',
125           'Topic :: Scientific/Engineering :: Medical Science Apps.',
126           'Topic :: System :: Distributed Computing',
127           'Topic :: Utilities',
128       ]
129      )
130
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cwltool/software_requirements.py b/cwltool/software_requirements.py
--- a/cwltool/software_requirements.py
+++ b/cwltool/software_requirements.py
@@ -18,8 +18,8 @@
 
 from .builder import Builder, HasReqsHints
 try:
-    from galaxy.tools.deps.requirements import ToolRequirement, ToolRequirements
-    from galaxy.tools import deps
+    from galaxy.tool_util.deps.requirements import ToolRequirement, ToolRequirements
+    from galaxy.tool_util import deps
 except ImportError:
     ToolRequirement = None  # type: ignore
     ToolRequirements = None  # type: ignore
@@ -49,7 +49,7 @@
             self.tool_dependency_dir = tool_dependency_dir
             self.dependency_resolvers_config_file = os.path.abspath(conf_file)
         elif conda_dependencies is not None:
-            if not tool_dependency_dir is not None:
+            if tool_dependency_dir is None:
                 tool_dependency_dir = os.path.abspath("./cwltool_deps")
             self.tool_dependency_dir = tool_dependency_dir
             self.use_tool_dependencies = True
@@ -57,17 +57,22 @@
         else:
             self.use_tool_dependencies = False
 
-    @property
-    def config_dict(self):  # type: () -> Dict[Text, bool]
-        return {
-            'conda_auto_install': True,
-            'conda_auto_init': True,
-        }
-
     def build_job_script(self, builder, command):
         # type: (Builder, List[str]) -> Text
         ensure_galaxy_lib_available()
-        tool_dependency_manager = deps.build_dependency_manager(self)  # type: deps.DependencyManager
+        resolution_config_dict = {
+            'use': self.use_tool_dependencies,
+            'default_base_path': self.tool_dependency_dir,
+        }
+        app_config = {
+            'conda_auto_install': True,
+            'conda_auto_init': True,
+        }
+        tool_dependency_manager = deps.build_dependency_manager(
+            app_config_dict=app_config,
+            resolution_config_dict=resolution_config_dict,
+            conf_file=self.dependency_resolvers_config_file,
+        )  # type: deps.DependencyManager
         dependencies = get_dependencies(builder)
         handle_dependencies = ""  # str
         if dependencies:
@@ -107,10 +112,11 @@
     # type: (bool, HasReqsHints) -> Optional[Text]
     if use_biocontainers:
         ensure_galaxy_lib_available()
-        from galaxy.tools.deps.containers import ContainerRegistry, AppInfo, ToolInfo, DOCKER_CONTAINER_TYPE
+        from galaxy.tool_util.deps.dependencies import AppInfo, ToolInfo
+        from galaxy.tool_util.deps.containers import ContainerRegistry, DOCKER_CONTAINER_TYPE
         app_info = AppInfo(
             involucro_auto_init=True,
-            enable_beta_mulled_containers=True,
+            enable_mulled_containers=True,
             container_image_cache_path=".",
         )  # type: AppInfo
         container_registry = ContainerRegistry(app_info)  # type: ContainerRegistry
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -80,7 +80,7 @@
       extras_require={
           ':os.name=="posix" and python_version<"3.5"': ['subprocess32 >= 3.5.0'],
           ':python_version<"3.6"': ['typing >= 3.5.3'],
-          'deps': ["galaxy-lib >= 17.09.9, <= 18.9.2 "],
+          'deps': ["galaxy-tool-util"],
           'docs': ["sphinx >= 2.2", "sphinx-rtd-theme"],
       },
       python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',

{"golden_diff": "diff --git a/cwltool/software_requirements.py b/cwltool/software_requirements.py\n--- a/cwltool/software_requirements.py\n+++ b/cwltool/software_requirements.py\n@@ -18,8 +18,8 @@\n \n from .builder import Builder, HasReqsHints\n try:\n-    from galaxy.tools.deps.requirements import ToolRequirement, ToolRequirements\n-    from galaxy.tools import deps\n+    from galaxy.tool_util.deps.requirements import ToolRequirement, ToolRequirements\n+    from galaxy.tool_util import deps\n except ImportError:\n     ToolRequirement = None  # type: ignore\n     ToolRequirements = None  # type: ignore\n@@ -49,7 +49,7 @@\n             self.tool_dependency_dir = tool_dependency_dir\n             self.dependency_resolvers_config_file = os.path.abspath(conf_file)\n         elif conda_dependencies is not None:\n-            if not tool_dependency_dir is not None:\n+            if tool_dependency_dir is None:\n                 tool_dependency_dir = os.path.abspath(\"./cwltool_deps\")\n             self.tool_dependency_dir = tool_dependency_dir\n             self.use_tool_dependencies = True\n@@ -57,17 +57,22 @@\n         else:\n             self.use_tool_dependencies = False\n \n-    @property\n-    def config_dict(self):  # type: () -> Dict[Text, bool]\n-        return {\n-            'conda_auto_install': True,\n-            'conda_auto_init': True,\n-        }\n-\n     def build_job_script(self, builder, command):\n         # type: (Builder, List[str]) -> Text\n         ensure_galaxy_lib_available()\n-        tool_dependency_manager = deps.build_dependency_manager(self)  # type: deps.DependencyManager\n+        resolution_config_dict = {\n+            'use': self.use_tool_dependencies,\n+            'default_base_path': self.tool_dependency_dir,\n+        }\n+        app_config = {\n+            'conda_auto_install': True,\n+            'conda_auto_init': True,\n+        }\n+        tool_dependency_manager = deps.build_dependency_manager(\n+            app_config_dict=app_config,\n+            resolution_config_dict=resolution_config_dict,\n+            conf_file=self.dependency_resolvers_config_file,\n+        )  # type: deps.DependencyManager\n         dependencies = get_dependencies(builder)\n         handle_dependencies = \"\"  # str\n         if dependencies:\n@@ -107,10 +112,11 @@\n     # type: (bool, HasReqsHints) -> Optional[Text]\n     if use_biocontainers:\n         ensure_galaxy_lib_available()\n-        from galaxy.tools.deps.containers import ContainerRegistry, AppInfo, ToolInfo, DOCKER_CONTAINER_TYPE\n+        from galaxy.tool_util.deps.dependencies import AppInfo, ToolInfo\n+        from galaxy.tool_util.deps.containers import ContainerRegistry, DOCKER_CONTAINER_TYPE\n         app_info = AppInfo(\n             involucro_auto_init=True,\n-            enable_beta_mulled_containers=True,\n+            enable_mulled_containers=True,\n             container_image_cache_path=\".\",\n         )  # type: AppInfo\n         container_registry = ContainerRegistry(app_info)  # type: ContainerRegistry\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -80,7 +80,7 @@\n       extras_require={\n           ':os.name==\"posix\" and python_version<\"3.5\"': ['subprocess32 >= 3.5.0'],\n           ':python_version<\"3.6\"': ['typing >= 3.5.3'],\n-          'deps': [\"galaxy-lib >= 17.09.9, <= 18.9.2 \"],\n+          'deps': [\"galaxy-tool-util\"],\n           'docs': [\"sphinx >= 2.2\", \"sphinx-rtd-theme\"],\n       },\n       python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',\n", "issue": "Replace galaxy-lib requirement with galaxy-tool-util\nI'm working on Planemo to replace its dependency on galaxy-lib (which will be basically deprecated with Galaxy release 19.09) with [galaxy-tool-util](https://pypi.org/project/galaxy-tool-util/). Unfortunately CWL support in Planemo via cwltool would break unless also cwltool moves to galaxy-tool-util.\r\n\r\nI can do the necessary changes in cwltool when I'm back from holidays, in the mean time I wanted to check that's fine with you all.\n", "before_files": [{"content": "\"\"\"This module handles resolution of SoftwareRequirement hints.\n\nThis is accomplished mainly by adapting cwltool internals to galaxy-lib's\nconcept of \"dependencies\". Despite the name, galaxy-lib is a light weight\nlibrary that can be used to map SoftwareRequirements in all sorts of ways -\nHomebrew, Conda, custom scripts, environment modules. We'd be happy to find\nways to adapt new packages managers and such as well.\n\"\"\"\nfrom __future__ import absolute_import\n\nimport argparse  # pylint: disable=unused-import\nimport os\nimport string\nfrom typing import Dict, List, MutableSequence, Optional\n\nfrom typing_extensions import Text  # pylint: disable=unused-import\n# move to a regular typing import when Python 3.3-3.6 is no longer supported\n\nfrom .builder import Builder, HasReqsHints\ntry:\n    from galaxy.tools.deps.requirements import ToolRequirement, ToolRequirements\n    from galaxy.tools import deps\nexcept ImportError:\n    ToolRequirement = None  # type: ignore\n    ToolRequirements = None  # type: ignore\n    deps = None  # type: ignore\n\n\nSOFTWARE_REQUIREMENTS_ENABLED = deps is not None\n\nCOMMAND_WITH_DEPENDENCIES_TEMPLATE = string.Template(\"\"\"#!/bin/bash\n$handle_dependencies\npython \"run_job.py\" \"job.json\"\n\"\"\")\n\n\nclass DependenciesConfiguration(object):\n\n    def __init__(self, args):\n        # type: (argparse.Namespace) -> None\n        \"\"\"Initialize.\"\"\"\n        conf_file = getattr(args, \"beta_dependency_resolvers_configuration\", None)\n        tool_dependency_dir = getattr(args, \"beta_dependencies_directory\", None)\n        conda_dependencies = getattr(args, \"beta_conda_dependencies\", None)\n        if conf_file is not None and os.path.exists(conf_file):\n            self.use_tool_dependencies = True\n            if tool_dependency_dir is None:\n                tool_dependency_dir = os.path.abspath(os.path.dirname(conf_file))\n            self.tool_dependency_dir = tool_dependency_dir\n            self.dependency_resolvers_config_file = os.path.abspath(conf_file)\n        elif conda_dependencies is not None:\n            if not tool_dependency_dir is not None:\n                tool_dependency_dir = os.path.abspath(\"./cwltool_deps\")\n            self.tool_dependency_dir = tool_dependency_dir\n            self.use_tool_dependencies = True\n            self.dependency_resolvers_config_file = None\n        else:\n            self.use_tool_dependencies = False\n\n    @property\n    def config_dict(self):  # type: () -> Dict[Text, bool]\n        return {\n            'conda_auto_install': True,\n            'conda_auto_init': True,\n        }\n\n    def build_job_script(self, builder, command):\n        # type: (Builder, List[str]) -> Text\n        ensure_galaxy_lib_available()\n        tool_dependency_manager = deps.build_dependency_manager(self)  # type: deps.DependencyManager\n        dependencies = get_dependencies(builder)\n        handle_dependencies = \"\"  # str\n        if dependencies:\n            handle_dependencies = \"\\n\".join(\n                tool_dependency_manager.dependency_shell_commands(\n                    dependencies, job_directory=builder.tmpdir))\n\n        template_kwds = dict(handle_dependencies=handle_dependencies)  # type: Dict[str, str]\n        job_script = COMMAND_WITH_DEPENDENCIES_TEMPLATE.substitute(template_kwds)\n        return job_script\n\n\ndef get_dependencies(builder):  # type: (HasReqsHints) -> ToolRequirements\n    (software_requirement, _) = builder.get_requirement(\"SoftwareRequirement\")\n    dependencies = []  # type: List[ToolRequirement]\n    if software_requirement and software_requirement.get(\"packages\"):\n        packages = software_requirement.get(\"packages\")\n        for package in packages:\n            version = package.get(\"version\", None)\n            if isinstance(version, MutableSequence):\n                if version:\n                    version = version[0]\n                else:\n                    version = None\n            specs = [{\"uri\": s} for s in package.get(\"specs\", [])]\n            dependencies.append(ToolRequirement.from_dict(dict(\n                name=package[\"package\"].split(\"#\")[-1],\n                version=version,\n                type=\"package\",\n                specs=specs,\n            )))\n\n    return ToolRequirements.from_list(dependencies)\n\n\ndef get_container_from_software_requirements(use_biocontainers, builder):\n    # type: (bool, HasReqsHints) -> Optional[Text]\n    if use_biocontainers:\n        ensure_galaxy_lib_available()\n        from galaxy.tools.deps.containers import ContainerRegistry, AppInfo, ToolInfo, DOCKER_CONTAINER_TYPE\n        app_info = AppInfo(\n            involucro_auto_init=True,\n            enable_beta_mulled_containers=True,\n            container_image_cache_path=\".\",\n        )  # type: AppInfo\n        container_registry = ContainerRegistry(app_info)  # type: ContainerRegistry\n        requirements = get_dependencies(builder)\n        tool_info = ToolInfo(requirements=requirements)  # type: ToolInfo\n        container_description = container_registry.find_best_container_description([DOCKER_CONTAINER_TYPE], tool_info)\n        if container_description:\n            return container_description.identifier\n\n    return None\n\n\ndef ensure_galaxy_lib_available():\n    # type: () -> None\n    if not SOFTWARE_REQUIREMENTS_ENABLED:\n        raise Exception(\"Optional Python library galaxy-lib not available, it is required for this configuration.\")\n", "path": "cwltool/software_requirements.py"}, {"content": "#!/usr/bin/env python\n\"\"\"Setup for the reference implementation of the CWL standards.\"\"\"\nfrom __future__ import print_function\nimport os\nimport sys\n\nimport setuptools.command.egg_info as egg_info_cmd\nfrom setuptools import setup\n\nSETUP_DIR = os.path.dirname(__file__)\nREADME = os.path.join(SETUP_DIR, 'README.rst')\n\ntry:\n    import gittaggers\n\n    Tagger = gittaggers.EggInfoFromGit\nexcept ImportError:\n    Tagger = egg_info_cmd.egg_info\n\nNEEDS_PYTEST = {'pytest', 'test', 'ptr'}.intersection(sys.argv)\nPYTEST_RUNNER = ['pytest-runner', 'pytest-cov'] if NEEDS_PYTEST else []\n\nif sys.version_info < (3, 0):\n    print(\"\"\"\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.\nPlease upgrade your Python as the Python 2.7 version of cwltool won't be\nmaintained after that date.\n\"\"\", file=sys.stderr)\n\nsetup(name='cwltool',\n      version='1.0',\n      description='Common workflow language reference implementation',\n      long_description=open(README).read(),\n      long_description_content_type=\"text/x-rst\",\n      author='Common workflow language working group',\n      author_email='common-workflow-language@googlegroups.com',\n      url=\"https://github.com/common-workflow-language/cwltool\",\n      download_url=\"https://github.com/common-workflow-language/cwltool\",\n      # platforms='',  # empty as is conveyed by the classifier below\n      # license='',  # empty as is conveyed by the classifier below\n      packages=[\"cwltool\", 'cwltool.tests'],\n      package_dir={'cwltool.tests': 'tests'},\n      package_data={'cwltool': [\n          'schemas/v1.0/*.yml',\n          'schemas/v1.0/*.md',\n          'schemas/v1.0/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.0/salad/schema_salad/metaschema/*.md',\n          'schemas/v1.1.0-dev1/*.yml',\n          'schemas/v1.1.0-dev1/*.md',\n          'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.md',\n          'schemas/v1.1/*.yml',\n          'schemas/v1.1/*.md',\n          'schemas/v1.1/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.1/salad/schema_salad/metaschema/*.md',\n          'cwlNodeEngine.js',\n          'cwlNodeEngineJSConsole.js',\n          'extensions.yml',\n          'hello.simg']},\n      include_package_data=True,\n      install_requires=[\n          'setuptools',\n          'requests >= 2.6.1',  # >= 2.6.1 to workaround\n          # https://github.com/ionrock/cachecontrol/issues/137\n          'ruamel.yaml >= 0.12.4, <= 0.16',\n          'rdflib >= 4.2.2, < 4.3.0',\n          'shellescape >= 3.4.1, < 3.5',\n          'schema-salad >= 4.5, < 5',\n          'mypy-extensions',\n          'six >= 1.9.0',  # >= 1.9.0 required by prov\n          'psutil',\n          'scandir',\n          'prov == 1.5.1',\n          'bagit >= 1.6.4',\n          'typing-extensions',\n          'coloredlogs',\n          'future >= 0.16',\n          'pathlib2 != 2.3.1'\n      ],\n      extras_require={\n          ':os.name==\"posix\" and python_version<\"3.5\"': ['subprocess32 >= 3.5.0'],\n          ':python_version<\"3.6\"': ['typing >= 3.5.3'],\n          'deps': [\"galaxy-lib >= 17.09.9, <= 18.9.2 \"],\n          'docs': [\"sphinx >= 2.2\", \"sphinx-rtd-theme\"],\n      },\n      python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',\n      setup_requires=PYTEST_RUNNER,\n      test_suite='tests',\n      tests_require=['pytest < 4.3.0', 'mock >= 2.0.0', 'pytest-mock >= 1.10.0',\n                     'arcp >= 0.2.0', 'rdflib-jsonld >= 0.4.0'],\n      entry_points={\n          'console_scripts': [\"cwltool=cwltool.main:run\"]\n      },\n      zip_safe=True,\n      cmdclass={'egg_info': Tagger},\n      classifiers=[\n          'Development Status :: 5 - Production/Stable',\n          'Environment :: Console',\n          'Intended Audience :: Developers',\n          'Intended Audience :: Science/Research',\n          'Intended Audience :: Healthcare Industry',\n          'License :: OSI Approved :: Apache Software License',\n          'Natural Language :: English',\n          'Operating System :: MacOS :: MacOS X',\n          'Operating System :: POSIX',\n          'Operating System :: POSIX :: Linux',\n          'Operating System :: OS Independent',\n          'Operating System :: Microsoft :: Windows',\n          'Operating System :: Microsoft :: Windows :: Windows 10',\n          'Operating System :: Microsoft :: Windows :: Windows 8.1',\n          # 'Operating System :: Microsoft :: Windows :: Windows 8',  # not tested\n          # 'Operating System :: Microsoft :: Windows :: Windows 7',  # not tested\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.5',\n          'Programming Language :: Python :: 3.6',\n          'Programming Language :: Python :: 3.7',\n          'Programming Language :: Python :: 3.8',\n          'Topic :: Scientific/Engineering',\n          'Topic :: Scientific/Engineering :: Bio-Informatics',\n          'Topic :: Scientific/Engineering :: Astronomy',\n          'Topic :: Scientific/Engineering :: Atmospheric Science',\n          'Topic :: Scientific/Engineering :: Information Analysis',\n          'Topic :: Scientific/Engineering :: Medical Science Apps.',\n          'Topic :: System :: Distributed Computing',\n          'Topic :: Utilities',\n      ]\n     )\n", "path": "setup.py"}], "after_files": [{"content": "\"\"\"This module handles resolution of SoftwareRequirement hints.\n\nThis is accomplished mainly by adapting cwltool internals to galaxy-lib's\nconcept of \"dependencies\". Despite the name, galaxy-lib is a light weight\nlibrary that can be used to map SoftwareRequirements in all sorts of ways -\nHomebrew, Conda, custom scripts, environment modules. We'd be happy to find\nways to adapt new packages managers and such as well.\n\"\"\"\nfrom __future__ import absolute_import\n\nimport argparse  # pylint: disable=unused-import\nimport os\nimport string\nfrom typing import Dict, List, MutableSequence, Optional\n\nfrom typing_extensions import Text  # pylint: disable=unused-import\n# move to a regular typing import when Python 3.3-3.6 is no longer supported\n\nfrom .builder import Builder, HasReqsHints\ntry:\n    from galaxy.tool_util.deps.requirements import ToolRequirement, ToolRequirements\n    from galaxy.tool_util import deps\nexcept ImportError:\n    ToolRequirement = None  # type: ignore\n    ToolRequirements = None  # type: ignore\n    deps = None  # type: ignore\n\n\nSOFTWARE_REQUIREMENTS_ENABLED = deps is not None\n\nCOMMAND_WITH_DEPENDENCIES_TEMPLATE = string.Template(\"\"\"#!/bin/bash\n$handle_dependencies\npython \"run_job.py\" \"job.json\"\n\"\"\")\n\n\nclass DependenciesConfiguration(object):\n\n    def __init__(self, args):\n        # type: (argparse.Namespace) -> None\n        \"\"\"Initialize.\"\"\"\n        conf_file = getattr(args, \"beta_dependency_resolvers_configuration\", None)\n        tool_dependency_dir = getattr(args, \"beta_dependencies_directory\", None)\n        conda_dependencies = getattr(args, \"beta_conda_dependencies\", None)\n        if conf_file is not None and os.path.exists(conf_file):\n            self.use_tool_dependencies = True\n            if tool_dependency_dir is None:\n                tool_dependency_dir = os.path.abspath(os.path.dirname(conf_file))\n            self.tool_dependency_dir = tool_dependency_dir\n            self.dependency_resolvers_config_file = os.path.abspath(conf_file)\n        elif conda_dependencies is not None:\n            if tool_dependency_dir is None:\n                tool_dependency_dir = os.path.abspath(\"./cwltool_deps\")\n            self.tool_dependency_dir = tool_dependency_dir\n            self.use_tool_dependencies = True\n            self.dependency_resolvers_config_file = None\n        else:\n            self.use_tool_dependencies = False\n\n    def build_job_script(self, builder, command):\n        # type: (Builder, List[str]) -> Text\n        ensure_galaxy_lib_available()\n        resolution_config_dict = {\n            'use': self.use_tool_dependencies,\n            'default_base_path': self.tool_dependency_dir,\n        }\n        app_config = {\n            'conda_auto_install': True,\n            'conda_auto_init': True,\n        }\n        tool_dependency_manager = deps.build_dependency_manager(\n            app_config_dict=app_config,\n            resolution_config_dict=resolution_config_dict,\n            conf_file=self.dependency_resolvers_config_file,\n        )  # type: deps.DependencyManager\n        dependencies = get_dependencies(builder)\n        handle_dependencies = \"\"  # str\n        if dependencies:\n            handle_dependencies = \"\\n\".join(\n                tool_dependency_manager.dependency_shell_commands(\n                    dependencies, job_directory=builder.tmpdir))\n\n        template_kwds = dict(handle_dependencies=handle_dependencies)  # type: Dict[str, str]\n        job_script = COMMAND_WITH_DEPENDENCIES_TEMPLATE.substitute(template_kwds)\n        return job_script\n\n\ndef get_dependencies(builder):  # type: (HasReqsHints) -> ToolRequirements\n    (software_requirement, _) = builder.get_requirement(\"SoftwareRequirement\")\n    dependencies = []  # type: List[ToolRequirement]\n    if software_requirement and software_requirement.get(\"packages\"):\n        packages = software_requirement.get(\"packages\")\n        for package in packages:\n            version = package.get(\"version\", None)\n            if isinstance(version, MutableSequence):\n                if version:\n                    version = version[0]\n                else:\n                    version = None\n            specs = [{\"uri\": s} for s in package.get(\"specs\", [])]\n            dependencies.append(ToolRequirement.from_dict(dict(\n                name=package[\"package\"].split(\"#\")[-1],\n                version=version,\n                type=\"package\",\n                specs=specs,\n            )))\n\n    return ToolRequirements.from_list(dependencies)\n\n\ndef get_container_from_software_requirements(use_biocontainers, builder):\n    # type: (bool, HasReqsHints) -> Optional[Text]\n    if use_biocontainers:\n        ensure_galaxy_lib_available()\n        from galaxy.tool_util.deps.dependencies import AppInfo, ToolInfo\n        from galaxy.tool_util.deps.containers import ContainerRegistry, DOCKER_CONTAINER_TYPE\n        app_info = AppInfo(\n            involucro_auto_init=True,\n            enable_mulled_containers=True,\n            container_image_cache_path=\".\",\n        )  # type: AppInfo\n        container_registry = ContainerRegistry(app_info)  # type: ContainerRegistry\n        requirements = get_dependencies(builder)\n        tool_info = ToolInfo(requirements=requirements)  # type: ToolInfo\n        container_description = container_registry.find_best_container_description([DOCKER_CONTAINER_TYPE], tool_info)\n        if container_description:\n            return container_description.identifier\n\n    return None\n\n\ndef ensure_galaxy_lib_available():\n    # type: () -> None\n    if not SOFTWARE_REQUIREMENTS_ENABLED:\n        raise Exception(\"Optional Python library galaxy-lib not available, it is required for this configuration.\")\n", "path": "cwltool/software_requirements.py"}, {"content": "#!/usr/bin/env python\n\"\"\"Setup for the reference implementation of the CWL standards.\"\"\"\nfrom __future__ import print_function\nimport os\nimport sys\n\nimport setuptools.command.egg_info as egg_info_cmd\nfrom setuptools import setup\n\nSETUP_DIR = os.path.dirname(__file__)\nREADME = os.path.join(SETUP_DIR, 'README.rst')\n\ntry:\n    import gittaggers\n\n    Tagger = gittaggers.EggInfoFromGit\nexcept ImportError:\n    Tagger = egg_info_cmd.egg_info\n\nNEEDS_PYTEST = {'pytest', 'test', 'ptr'}.intersection(sys.argv)\nPYTEST_RUNNER = ['pytest-runner', 'pytest-cov'] if NEEDS_PYTEST else []\n\nif sys.version_info < (3, 0):\n    print(\"\"\"\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.\nPlease upgrade your Python as the Python 2.7 version of cwltool won't be\nmaintained after that date.\n\"\"\", file=sys.stderr)\n\nsetup(name='cwltool',\n      version='1.0',\n      description='Common workflow language reference implementation',\n      long_description=open(README).read(),\n      long_description_content_type=\"text/x-rst\",\n      author='Common workflow language working group',\n      author_email='common-workflow-language@googlegroups.com',\n      url=\"https://github.com/common-workflow-language/cwltool\",\n      download_url=\"https://github.com/common-workflow-language/cwltool\",\n      # platforms='',  # empty as is conveyed by the classifier below\n      # license='',  # empty as is conveyed by the classifier below\n      packages=[\"cwltool\", 'cwltool.tests'],\n      package_dir={'cwltool.tests': 'tests'},\n      package_data={'cwltool': [\n          'schemas/v1.0/*.yml',\n          'schemas/v1.0/*.md',\n          'schemas/v1.0/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.0/salad/schema_salad/metaschema/*.md',\n          'schemas/v1.1.0-dev1/*.yml',\n          'schemas/v1.1.0-dev1/*.md',\n          'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.1.0-dev1/salad/schema_salad/metaschema/*.md',\n          'schemas/v1.1/*.yml',\n          'schemas/v1.1/*.md',\n          'schemas/v1.1/salad/schema_salad/metaschema/*.yml',\n          'schemas/v1.1/salad/schema_salad/metaschema/*.md',\n          'cwlNodeEngine.js',\n          'cwlNodeEngineJSConsole.js',\n          'extensions.yml',\n          'hello.simg']},\n      include_package_data=True,\n      install_requires=[\n          'setuptools',\n          'requests >= 2.6.1',  # >= 2.6.1 to workaround\n          # https://github.com/ionrock/cachecontrol/issues/137\n          'ruamel.yaml >= 0.12.4, <= 0.16',\n          'rdflib >= 4.2.2, < 4.3.0',\n          'shellescape >= 3.4.1, < 3.5',\n          'schema-salad >= 4.5, < 5',\n          'mypy-extensions',\n          'six >= 1.9.0',  # >= 1.9.0 required by prov\n          'psutil',\n          'scandir',\n          'prov == 1.5.1',\n          'bagit >= 1.6.4',\n          'typing-extensions',\n          'coloredlogs',\n          'future >= 0.16',\n          'pathlib2 != 2.3.1'\n      ],\n      extras_require={\n          ':os.name==\"posix\" and python_version<\"3.5\"': ['subprocess32 >= 3.5.0'],\n          ':python_version<\"3.6\"': ['typing >= 3.5.3'],\n          'deps': [\"galaxy-tool-util\"],\n          'docs': [\"sphinx >= 2.2\", \"sphinx-rtd-theme\"],\n      },\n      python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',\n      setup_requires=PYTEST_RUNNER,\n      test_suite='tests',\n      tests_require=['pytest < 4.3.0', 'mock >= 2.0.0', 'pytest-mock >= 1.10.0',\n                     'arcp >= 0.2.0', 'rdflib-jsonld >= 0.4.0'],\n      entry_points={\n          'console_scripts': [\"cwltool=cwltool.main:run\"]\n      },\n      zip_safe=True,\n      cmdclass={'egg_info': Tagger},\n      classifiers=[\n          'Development Status :: 5 - Production/Stable',\n          'Environment :: Console',\n          'Intended Audience :: Developers',\n          'Intended Audience :: Science/Research',\n          'Intended Audience :: Healthcare Industry',\n          'License :: OSI Approved :: Apache Software License',\n          'Natural Language :: English',\n          'Operating System :: MacOS :: MacOS X',\n          'Operating System :: POSIX',\n          'Operating System :: POSIX :: Linux',\n          'Operating System :: OS Independent',\n          'Operating System :: Microsoft :: Windows',\n          'Operating System :: Microsoft :: Windows :: Windows 10',\n          'Operating System :: Microsoft :: Windows :: Windows 8.1',\n          # 'Operating System :: Microsoft :: Windows :: Windows 8',  # not tested\n          # 'Operating System :: Microsoft :: Windows :: Windows 7',  # not tested\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.5',\n          'Programming Language :: Python :: 3.6',\n          'Programming Language :: Python :: 3.7',\n          'Programming Language :: Python :: 3.8',\n          'Topic :: Scientific/Engineering',\n          'Topic :: Scientific/Engineering :: Bio-Informatics',\n          'Topic :: Scientific/Engineering :: Astronomy',\n          'Topic :: Scientific/Engineering :: Atmospheric Science',\n          'Topic :: Scientific/Engineering :: Information Analysis',\n          'Topic :: Scientific/Engineering :: Medical Science Apps.',\n          'Topic :: System :: Distributed Computing',\n          'Topic :: Utilities',\n      ]\n     )\n", "path": "setup.py"}]}