Skip to content

Commit

Permalink
Merge pull request #112 from bgruening/bgruening-patch-1
Browse files Browse the repository at this point in the history
start of fixing the packaging version
  • Loading branch information
mvdbeek authored Aug 25, 2023
2 parents ee3e08f + b3fc63d commit 26ddcfb
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 26ddcfb

Please sign in to comment.