Commit Graph
8705 Commits
Author SHA1 Message Date
John Davis 16e18d404e Merge pull request #19395 from mvdbeek/alternative_format_source_fix
Alternative `format_source` fix
2025-01-23 10:54:03 -05:00
Nicola Soranzo 8797f1e4ef Make `InstallationTarget` a runtime-checkable protocol
Also:
- Reuse its `installed_repository_manager` attribute instead of
  instantiating a `InstalledRepositoryManager` in several places.
2025-01-22 23:14:48 +00:00
David López 28e5f7d84b Merge pull request #19154 from kysrpex/file_sources_assign_paths
Let file sources choose a path for uploaded files
2025-01-20 16:11:57 +01:00
Nicola Soranzo 54df792117 Use CompressedFile.open_tar() to open tar files 2025-01-18 15:03:02 +00:00
Nicola Soranzo aa49793ecf Make CompressedFile a context manager
to ensure that the archive is closed.
2025-01-18 14:40:30 +00:00
Nicola Soranzo ccebdcb1f2 Set safe default extraction filter for tar archives
[PEP 706](https://peps.python.org/pep-0706/), first implemented in Python
3.11.4, mitigates some of the security issues of `TarFile.extract()` and
`TarFile.extractall()` by allowing to specify a `filter` keyword-only
parameter.
Set a safe default (`data_filter`) for the filter if available,
reverting to Python 3.11 behavior ('fully_trusted') otherwise, see
https://docs.python.org/3/library/tarfile.html#supporting-older-python-versions

Also:
- Remove unused `tar` parameter from `upload_tar()`
2025-01-18 14:40:29 +00:00
John Davis 9fc0f05935 Merge pull request #19366 from galaxybot/dev_auto_update_dependencies
Update Python dependencies
2025-01-13 11:25:46 -05:00
Nicola Soranzo 39bb35bebc Merge branch 'release_24.2' into dev 2025-01-13 16:10:31 +00:00
Marius van den Beek 2d629d0f44 Merge pull request #19208 from bernt-matthias/OutputsFilterExpression-fixes
[24.2]  Outputs filter linter fixes
2025-01-13 18:09:06 +02:00
Nicola Soranzo f799a996e1 Ignore mypy unused-ignore error on Python >=3.10 2025-01-13 12:00:55 +00:00
mvdbeek f28ea20d46 Fix unit test 2025-01-10 23:37:11 +02:00
mvdbeek 7566674baa Fix type annotation resulting from annotating HDCA.collection 2025-01-10 23:37:10 +02:00
mvdbeek f65b754dd0 Add regression test for https://github.com/galaxyproject/galaxy/issues/19245 2025-01-10 18:55:08 +02:00
Nicola Soranzo 944450aa38 Uniform use of tmp_path in ro-crate tests 2025-01-10 15:12:17 +00:00
mvdbeek 05ede4ab0e Fix planemo timeout handling
Planemo calls `verify_tool` with a maxseconds value,
and then sets `tool_test_dict.setdefault("maxseconds", maxseconds)`,
which fails, since we are serializing and already setting the default
maxseconds while parsing the test dict.

Fixes the IUC tool test timeouts not working when testing against 24.2.
Broken in
https://github.com/galaxyproject/galaxy/commit/9695ccc3c45a14b36beccfbaac69036a5ac65c21#diff-06835be1d1943ebce8373e2cd1f8e86c7b7813b720398850c978b734dd29e2daR1390
(maxseconds was prviously not serialized at all in
`ToolTestDescription.to_dict`)
2025-01-08 13:16:50 +02:00
Nicola Soranzo cd999d2a86 Merge branch 'release_24.2' into dev 2025-01-07 22:27:15 +00:00
John Chilton 356ed821a4 Merge pull request #19374 from mvdbeek/improve_conditional_specificity
Make conditional discriminators literals instead of generic string/bool
2025-01-07 11:42:35 -05:00
John Chilton f8ae3ce6ec Merge pull request #19332 from mvdbeek/fix_null_replacement
[24.2] Fix workflows with optional non-default parameter input
2025-01-07 10:08:58 -05:00
mvdbeek 384dfc8b4e Make conditional discriminators literals instead of generic string/bool
That's a much better consumer experience. A model generated for
gx_conditional.xml would look like
```typescript
export type ConditionalType =
  | WhenTestParameterA
  | WhenTestParameterB
  | WhenTestParameterC
export type TestParameter = "a"
export type IntegerParameter = number
export type TestParameter1 = "b"
export type BooleanParameter = boolean
export type TestParameter2 = "c"
export type ColorParameter = string

export interface MySchema {
  conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
  test_parameter: TestParameter
  integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
  test_parameter: TestParameter1
  boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
  test_parameter: TestParameter2
  color_parameter: ColorParameter
}

```
instead of
```typescript
export type ConditionalType =
  | WhenTestParameterA
  | WhenTestParameterB
  | WhenTestParameterC
export type TestParameter = string | boolean
export type IntegerParameter = number
export type TestParameter1 = string | boolean
export type BooleanParameter = boolean
export type TestParameter2 = string | boolean
export type ColorParameter = string

export interface MySchema {
  conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
  test_parameter: TestParameter
  integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
  test_parameter: TestParameter1
  boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
  test_parameter: TestParameter2
  color_parameter: ColorParameter
}

```
With the new model I can write an input object without looking at the
tool source, with the previous one I don't know what string I would need
to supply.
2025-01-03 16:17:49 +02:00
Nicola Soranzo 94bff7786c Type annotation fixes for mypy 1.14.0 2024-12-30 15:23:21 +00:00
mvdbeek b88a792b93 Merge branch 'release_24.2' into dev 2024-12-20 11:19:56 +01:00
mvdbeek 962839d68d Merge branch 'release_24.1' into release_24.2 2024-12-20 11:19:12 +01:00
Marius van den Beek 724157fb27 Merge pull request #19352 from mvdbeek/update_select_from_test
[24.1] Use select_from_url test data from github, not usegalaxy.org
2024-12-20 11:18:29 +01:00
Marius van den BeekandNicola Soranzo d66555ec1e ...
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2024-12-19 16:54:03 +01:00
Nicola Soranzo 4fa092c860 Merge branch 'release_24.1' into release_24.2 2024-12-19 15:45:08 +00:00
Nicola Soranzo 8f0465f0ca Merge branch 'release_24.0' into release_24.1 2024-12-19 15:18:45 +00:00
Marius van den Beek 5c2a471afa Fix branch reference 2024-12-19 15:47:09 +01:00
mvdbeek 02492685cc Use select_from_url test data from github, not usegalaxy.org 2024-12-19 14:14:05 +01:00
mvdbeek f4ee34f507 Record NO_REPLACEMENT as step output for unspecified value 2024-12-19 12:51:09 +01:00
Nicola Soranzo c67ffe8c76 Fix test_singularity_container_test test
(which started failing since ubuntu-latest was moved to 24.04)
by upgrading apptainer to >=1.3.3 to include
https://github.com/apptainer/apptainer/pull/2262 .

Fix:

```
>       assert "samtools:1.0--1" in results["passed"], results
E       AssertionError:
E       {'failed': [{'commands': ['python -c "import pyBigWig; assert(pyBigWig.numpy '
E                                 '== 1); assert(pyBigWig.remote == 1)"'],
E                    'container': 'pybigwig:0.3.22--py36h54a71a5_0',
E                    'errors': [{'command': 'python -c "import pyBigWig; '
E                                           'assert(pyBigWig.numpy == 1); '
E                                           'assert(pyBigWig.remote == 1)"',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'},
E                               {'import': 'pyBigWig',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'}],
E                    'import_lang': 'python -c',
E                    'imports': ['pyBigWig']},
E                   {'commands': ['samtools view --help 2>&1 | grep Notes > /dev/null'],
E                    'container': 'samtools:1.0--1',
E                    'errors': [{'command': 'samtools view --help 2>&1 | grep Notes > '
E                                           '/dev/null',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'}],
E                    'import_lang': 'python -c'}],
E        'notest': ['yasm:1.3.0--0'],
E        'passed': []}
E       assert 'samtools:1.0--1' in []
```

Also:
- Improve assertion messages to facilitate debugging
2024-12-18 18:00:12 +00:00
Nicola Soranzo 4e650b4e9a Fix test_singularity_container_test test
(which started failing since ubuntu-latest was moved to 24.04)
by upgrading apptainer to >=1.3.3 to include
https://github.com/apptainer/apptainer/pull/2262 .

Fix:

```
>       assert "samtools:1.0--1" in results["passed"], results
E       AssertionError:
E       {'failed': [{'commands': ['python -c "import pyBigWig; assert(pyBigWig.numpy '
E                                 '== 1); assert(pyBigWig.remote == 1)"'],
E                    'container': 'pybigwig:0.3.22--py36h54a71a5_0',
E                    'errors': [{'command': 'python -c "import pyBigWig; '
E                                           'assert(pyBigWig.numpy == 1); '
E                                           'assert(pyBigWig.remote == 1)"',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'},
E                               {'import': 'pyBigWig',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'}],
E                    'import_lang': 'python -c',
E                    'imports': ['pyBigWig']},
E                   {'commands': ['samtools view --help 2>&1 | grep Notes > /dev/null'],
E                    'container': 'samtools:1.0--1',
E                    'errors': [{'command': 'samtools view --help 2>&1 | grep Notes > '
E                                           '/dev/null',
E                                'output': '\x1b[91mERROR  : Could not write info to '
E                                          'setgroups: Permission denied\n'
E                                          '\x1b[0m\x1b[91mERROR  : Error while '
E                                          'waiting event for user namespace mappings: '
E                                          'no event received\n'
E                                          '\x1b[0m'}],
E                    'import_lang': 'python -c'}],
E        'notest': ['yasm:1.3.0--0'],
E        'passed': []}
E       assert 'samtools:1.0--1' in []
```

Also:
- Improve assertion messages to facilitate debugging
2024-12-17 21:07:36 +00:00
Nicola Soranzo b1cf76c3ea Fail earlier if archive download failed
Simplify debugging this traceback (which was just an intermittent
network error):

https://github.com/galaxyproject/galaxy/actions/runs/12374234876/job/34536295999

```
______________________ ERROR at setup of test_build_index ______________________

cls = <class 'tarfile.TarFile'>, name = None, mode = 'r'
fileobj = <gzip on 0x7f349cee7d00>, compresslevel = 9, kwargs = {}
GzipFile = <class 'gzip.GzipFile'>

    @classmethod
    def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
        """Open gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        """
        if mode not in ("r", "w", "x"):
            raise ValueError("mode must be 'r', 'w' or 'x'")

        try:
            from gzip import GzipFile
        except ImportError:
            raise CompressionError("gzip module is not available")

        try:
            fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
        except OSError:
            if fileobj is not None and mode == 'r':
                raise ReadError("not a gzip file")
            raise

        try:
>           t = cls.taropen(name, mode, fileobj, **kwargs)

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1854:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1831: in taropen
    return cls(name, mode, fileobj, **kwargs)
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1694: in __init__
    self.firstmember = self.next()
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:2578: in next
    tarinfo = self.tarinfo.fromtarfile(self)
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1282: in fromtarfile
    buf = tarfile.fileobj.read(BLOCKSIZE)
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/gzip.py:292: in read
    return self._buffer.read(size)
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/_compression.py:68: in readinto
    data = self.read(len(byte_view))
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/gzip.py:479: in read
    if not self._read_gzip_header():
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <gzip._GzipReader object at 0x7f349cee79a0>

    def _read_gzip_header(self):
        magic = self._fp.read(2)
        if magic == b'':
            return False

        if magic != b'\037\213':
>           raise BadGzipFile('Not a gzipped file (%r)' % magic)
E           gzip.BadGzipFile: Not a gzipped file (b'<!')

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/gzip.py:427: BadGzipFile

During handling of the above exception, another exception occurred:

    @pytest.fixture(scope="module")
    def community_file_dir():
        extracted_archive_dir = tempfile.mkdtemp()
        b = BytesIO(requests.get(URL).content)
>       tarfile.open(fileobj=b, mode="r:gz").extractall(extracted_archive_dir)

test/unit/tool_shed/test_shed_index.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1801: in open
    return func(name, filemode, fileobj, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'tarfile.TarFile'>, name = None, mode = 'r'
fileobj = <gzip on 0x7f349cee7d00>, compresslevel = 9, kwargs = {}
GzipFile = <class 'gzip.GzipFile'>

    @classmethod
    def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
        """Open gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        """
        if mode not in ("r", "w", "x"):
            raise ValueError("mode must be 'r', 'w' or 'x'")

        try:
            from gzip import GzipFile
        except ImportError:
            raise CompressionError("gzip module is not available")

        try:
            fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
        except OSError:
            if fileobj is not None and mode == 'r':
                raise ReadError("not a gzip file")
            raise

        try:
            t = cls.taropen(name, mode, fileobj, **kwargs)
        except OSError:
            fileobj.close()
            if mode == 'r':
>               raise ReadError("not a gzip file")
E               tarfile.ReadError: not a gzip file

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/tarfile.py:1858: ReadError
------------------------------ Captured log setup ------------------------------
DEBUG    urllib3.connectionpool:connectionpool.py:1022 Starting new HTTPS connection (1): github.com:443
DEBUG    urllib3.connectionpool:connectionpool.py:475 https://github.com:443 "GET /mvdbeek/toolshed-test-data/blob/master/toolshed_community_files.tgz?raw=true HTTP/1.1" 503 54894
```
2024-12-17 19:58:32 +00:00
Nicola Soranzo 53944010fd Use `resource_path()` to access datatypes_conf.xml.sample as a package resource
This required other changes included here as well:

1) Extend `parse_xml()` to accept a `Traversable` (i.e. the output of
   `resource_path()`.

Open the file before passing it to `etree.parse()`, since lxml's
implementation probably doesn't support a `Traversable`. This also
simplifies the exception handling, since the workaround for the missing
`errno` in the `OSError` exception is not needed any more.

------

2) Fix Galaxy startup when the ``data_manager_config_file`` config option
   is set to an empty value

When does this happen?
----------------------

planemo (which we use in the converters tests) set this option to an
empty value when not testing data managers:

https://github.com/galaxyproject/planemo/blob/master/planemo/galaxy/config.py#L452

This empty config value was resolved to the `path_resolves_to` directory
for this option.
With the change in 1) above, this results in the following traceback at
Galaxy startup:

```
Traceback (most recent call last):
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/webapps/galaxy/buildapp.py", line 68, in app_pair
    app = galaxy.app.UniverseApplication(global_conf=global_conf, is_webapp=True, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/app.py", line 777, in __init__
    self.data_managers = self._register_singleton(DataManagers)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/di.py", line 27, in _register_singleton
    instance = self[dep_type]
               ~~~~^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 381, in __getitem__
    return self.resolve(dep)
           ^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 265, in resolve
    return self._reflection_build_with_err_handling(dep_type, suppress_error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 392, in _reflection_build_with_err_handling
    return self._reflection_build(dep_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 408, in _reflection_build
    return dep_type(**sub_deps)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/tools/data_manager/manager.py", line 44, in __init__
    self.load_from_xml(filename)
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/tools/data_manager/manager.py", line 58, in load_from_xml
    tree = util.parse_xml(xml_filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/util/__init__.py", line 360, in parse_xml
    with source.open("rb") as f:
         ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmps2qq5htq'
```

Why is this a problem now?
--------------------------

Before this commit, `util.parse_xml()` was raising a `XMLSyntaxError`
exception if passed a directory, but now it raises an `IsADirectoryError`,
which is a subclass of `OSError` with errno 21.

As a consequence, when `load_from_xml()` in
lib/galaxy/tools/data_manager/manager.py
calls `util.parse_xml()` passing a directory, the resulting exception
is now re-raised in the `except OSError as e:` branch instead of
just being logged, which is actually good since this is a
misconfiguration.

Solutions
--------

- Do not resolve an empty/None path to the `path_resolves_to` directory.
- Do not check empty/None paths against root
- Adjst unit tests accordingly
- Raise an OSError if the `job_config_file` config option is set to null
  (previously this would be resolved to a directory, also raising an
  OSError when trying to open that as a file).

N.B.: This will also need to be fixed in Planemo by not setting the
`data_manager_config_file` option when not needed.
2024-12-17 18:01:57 +00:00
Nicola Soranzo 78234720c4 Replace deprecated `__package__ with __name__
`__package__` is deprecated since Python 3.13, see
https://docs.python.org/3/reference/datamodel.html#module.__package__

`importlib.resources.files()` can be passed a non-package module
since Python 3.12 (or importlib-resources 5.10.0, see
https://importlib-resources.readthedocs.io/en/latest/history.html#v5-10-0 ),
so we can use `__name__` instead of `__package__`.

Also, I noticed that in lib/galaxy/config/__init__.py we are passing
a directory to `importlib.resources.as_file()`, which is supported
only since Python 3.12 (or importlib-resources 5.9.0).

For the reasons above:
- Update conditional imports in `lib/galaxy/util/resources.py` to
  import from `importlib.resources` only for Python 3.12,
  otherwise from the importlib-resources package.
- Update importlib-resources requirement in galaxy-util package.
- Drop importlib-resources requirement from galaxy-web-apps as it's
  not imported directly from its code any more.
2024-12-16 15:16:41 +00:00
Nicola Soranzo 18dca18981 Use `resource_path()` to access datatypes_conf.xml.sample as a package resource
This required other changes included here as well:

1) Extend `parse_xml()` to accept a `Traversable` (i.e. the output of
   `resource_path()`.

Open the file before passing it to `etree.parse()`, since lxml's
implementation probably doesn't support a `Traversable`. This also
simplifies the exception handling, since the workaround for the missing
`errno` in the `OSError` exception is not needed any more.

------

2) Fix Galaxy startup when the ``data_manager_config_file`` config option
   is set to an empty value

When does this happen?
----------------------

planemo (which we use in the converters tests) set this option to an
empty value when not testing data managers:

https://github.com/galaxyproject/planemo/blob/master/planemo/galaxy/config.py#L452

This empty config value was resolved to the `path_resolves_to` directory
for this option.
With the change in 1) above, this results in the following traceback at
Galaxy startup:

```
Traceback (most recent call last):
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/webapps/galaxy/buildapp.py", line 68, in app_pair
    app = galaxy.app.UniverseApplication(global_conf=global_conf, is_webapp=True, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/app.py", line 777, in __init__
    self.data_managers = self._register_singleton(DataManagers)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/di.py", line 27, in _register_singleton
    instance = self[dep_type]
               ~~~~^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 381, in __getitem__
    return self.resolve(dep)
           ^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 265, in resolve
    return self._reflection_build_with_err_handling(dep_type, suppress_error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 392, in _reflection_build_with_err_handling
    return self._reflection_build(dep_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.12/site-packages/lagom/container.py", line 408, in _reflection_build
    return dep_type(**sub_deps)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/tools/data_manager/manager.py", line 44, in __init__
    self.load_from_xml(filename)
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/tools/data_manager/manager.py", line 58, in load_from_xml
    tree = util.parse_xml(xml_filename)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/util/__init__.py", line 360, in parse_xml
    with source.open("rb") as f:
         ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmps2qq5htq'
```

Why is this a problem now?
--------------------------

Before this commit, `util.parse_xml()` was raising a `XMLSyntaxError`
exception if passed a directory, but now it raises an `IsADirectoryError`,
which is a subclass of `OSError` with errno 21.

As a consequence, when `load_from_xml()` in
lib/galaxy/tools/data_manager/manager.py
calls `util.parse_xml()` passing a directory, the resulting exception
is now re-raised in the `except OSError as e:` branch instead of
just being logged, which is actually good since this is a
misconfiguration.

Solutions
--------

- Do not resolve an empty/None path to the `path_resolves_to` directory.
- Do not check empty/None paths against root
- Adjst unit tests accordingly
- Raise an OSError if the `job_config_file` config option is set to null
  (previously this would be resolved to a directory, also raising an
  OSError when trying to open that as a file).

N.B.: This will also need to be fixed in Planemo by not setting the
`data_manager_config_file` option when not needed.
2024-12-16 15:16:40 +00:00
Nicola Soranzo bbed4a85f8 Merge branch 'release_24.2' into dev 2024-12-10 21:17:36 +00:00
Nicola Soranzo 0991d59754 Merge branch 'release_24.1' into release_24.2 2024-12-10 14:40:02 +00:00
Nicola Soranzo e5f0a8c4eb Merge branch 'release_24.0' into release_24.1 2024-12-10 10:51:03 +00:00
Laila Los b19cbe4d01 fix tool menu container occurrences 2024-12-03 10:25:15 -05:00
Nicola Soranzo 0695babce0 Don't unnecessarily copy list in listify() 2024-12-02 12:51:56 +00:00
José Manuel Domínguez 6fe92643af Merge branch 'dev' into file_sources_assign_paths 2024-11-28 13:11:29 +01:00
mvdbeek 2d7667d958 Add regression test for #18927 2024-11-27 18:34:41 +01:00
Matthias Bernt a587336edd strip text
otherwise the parser gives an indentation error

also: we strip the text alo in the application
2024-11-26 17:18:44 +01:00
mvdbeek 40388b4dab Merge branch 'release_24.2' into dev 2024-11-26 16:47:33 +01:00
Dannon ff7025d4c0 Merge pull request #18729 from ElectronicBlueberry/workflow-editor-activity-bar
Workflow Editor Activity Bar
2024-11-26 09:28:29 -05:00
Marius van den Beek 71f87d8d05 Merge pull request #18951 from kostrykin/image-metadata/dev
Extend image metadata
2024-11-25 13:12:08 +01:00
Laila Los 0cab2664a4 fix tool menu container occurrences 2024-11-25 11:07:47 +01:00
Nicola Soranzo 26a4e146e0 Fix UP031 errors
reported by ruff 0.8.0 .
2024-11-24 21:35:23 +00:00
Marius van den Beek 363ab5342f Merge pull request #12941 from bernt-matthias/topic/data-table-filter
Dynamic options: add data table filter
2024-11-22 17:53:40 +01:00
John Davis 6bc9940445 Merge pull request #17600 from bernt-matthias/datatype-lint
[24.2] Add linters for datatypes
2024-11-22 10:36:44 -05:00