Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash autoupdate on non-PEP440-compliant tool versions #1422

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

nsoranzo
Copy link
Member

@nsoranzo nsoranzo commented Jan 8, 2024

Fix errors like:

File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/commands/cmd_autoupdate.py", line 120, in cli
    tools_to_update = autoupdate.get_tools_to_update(ctx, workflow, tools_to_skip)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 363, in get_tools_to_update
    return outdated_tools(ctx, wf_dict, ts, tools_to_skip)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 349, in outdated_tools
    outdated_tools_rec(wf_dict)
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 337, in outdated_tools_rec
    outdated_tool_dict.update(check_tool_step(tool_id))
                              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 324, in check_tool_step
    updated_tool_id = get_newest_tool_id(matching_tool_ids)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 290, in get_newest_tool_id
    return sorted(
           ^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 292, in <lambda>
    key=lambda n: packaging.version.parse(n.split("/")[-1]),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/packaging/version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '0.8.1+galaxy0+galaxy0'

seen e.g. in https://github.com/planemo-autoupdate/autoupdate/actions/runs/7443075417/job/20247438333 by using parse_version from galaxy.tool_util.version.

@nsoranzo nsoranzo requested a review from mvdbeek January 8, 2024 13:29
planemo/autoupdate.py Outdated Show resolved Hide resolved
Fix errors like:

```
File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/commands/cmd_autoupdate.py", line 120, in cli
    tools_to_update = autoupdate.get_tools_to_update(ctx, workflow, tools_to_skip)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 363, in get_tools_to_update
    return outdated_tools(ctx, wf_dict, ts, tools_to_skip)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 349, in outdated_tools
    outdated_tools_rec(wf_dict)
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 337, in outdated_tools_rec
    outdated_tool_dict.update(check_tool_step(tool_id))
                              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 324, in check_tool_step
    updated_tool_id = get_newest_tool_id(matching_tool_ids)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 290, in get_newest_tool_id
    return sorted(
           ^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/planemo/autoupdate.py", line 292, in <lambda>
    key=lambda n: packaging.version.parse(n.split("/")[-1]),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/packaging/version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '0.8.1+galaxy0+galaxy0'
```

seen e.g. in https://github.com/planemo-autoupdate/autoupdate/actions/runs/7443075417/job/20247438333 .
@nsoranzo nsoranzo merged commit 0b5df63 into galaxyproject:master Jan 11, 2024
14 checks passed
@nsoranzo nsoranzo deleted the parse_version_fix branch January 11, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants