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

Fix legacy version parsing by using Galaxy's version parsing if available #112

Merged
merged 1 commit into from
Aug 25, 2023
Merged
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
18 changes: 12 additions & 6 deletions tpv/core/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import packaging.version
try:
from galaxy.tool_util.version import parse_version
except ImportError:
# Fallback to an older `packaging` version when Galaxy < 23.1.
# If Galaxy is < 23.1 you need to have `packaging` in <= 21.3
from packaging.version import parse as parse_version

import random
from functools import reduce
from galaxy import model
Expand Down Expand Up @@ -89,20 +95,20 @@ def tag_values_match(entity, match_tag_values=[], exclude_tag_values=[]):


def tool_version_eq(tool, version):
return packaging.version.parse(tool.version) == packaging.version.parse(version)
return parse_version(tool.version) == parse_version(version)


def tool_version_lte(tool, version):
return packaging.version.parse(tool.version) <= packaging.version.parse(version)
return parse_version(tool.version) <= parse_version(version)


def tool_version_lt(tool, version):
return packaging.version.parse(tool.version) < packaging.version.parse(version)
return parse_version(tool.version) < parse_version(version)


def tool_version_gte(tool, version):
return packaging.version.parse(tool.version) >= packaging.version.parse(version)
return parse_version(tool.version) >= parse_version(version)


def tool_version_gt(tool, version):
return packaging.version.parse(tool.version) > packaging.version.parse(version)
return parse_version(tool.version) > parse_version(version)
Loading