Skip to content

Commit

Permalink
Merge pull request #1422 from nsoranzo/parse_version_fix
Browse files Browse the repository at this point in the history
Don't crash autoupdate on non-PEP440-compliant tool versions
  • Loading branch information
nsoranzo authored Jan 11, 2024
2 parents f6ce25c + 28ed426 commit 0b5df63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions planemo/autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
)
from xml.etree.ElementTree import ElementTree

import packaging.version
import requests
import yaml
from bioblend import toolshed
from bioblend.toolshed import ToolShedInstance
from galaxy.tool_util.deps import conda_util
from galaxy.tool_util.version import parse_version

import planemo.conda
from planemo.io import (
Expand Down Expand Up @@ -89,7 +89,7 @@ def check_conda(package_name: str, ctx: "PlanemoCliContext", **kwds) -> str:
search_results = itertools.chain.from_iterable(
n["versions"] for n in r.json() if n["name"] == package_name and n["owner"] in kwds["conda_ensure_channels"]
)
return sorted(search_results, key=packaging.version.parse, reverse=True)[0]
return sorted(search_results, key=parse_version, reverse=True)[0]

target = conda_util.CondaTarget(package_name)
best_search_results = conda_util.best_search_result(target, conda_context=conda_context)
Expand Down Expand Up @@ -289,7 +289,7 @@ def _update_wf(config: "LocalGalaxyConfig", workflow_id: str, instance: bool = F
def get_newest_tool_id(tool_ids: List[str]) -> str:
return sorted(
tool_ids,
key=lambda n: packaging.version.parse(n.split("/")[-1]),
key=lambda n: parse_version(n.split("/")[-1]),
)[-1]


Expand Down

0 comments on commit 0b5df63

Please sign in to comment.