Skip to content

Commit

Permalink
start of fixing the packaging version
Browse files Browse the repository at this point in the history
  • Loading branch information
bgruening authored Aug 25, 2023
1 parent 1f5b0a5 commit b3fc63d
Showing 1 changed file with 12 additions and 6 deletions.
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)

0 comments on commit b3fc63d

Please sign in to comment.