From 57688f1cdb8ec2ba8f66748ffb94e44c62583d5f Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 16 Mar 2022 14:36:04 -0400 Subject: [PATCH 1/2] Attempt a workaround to numeric sorting in the local portion of tool versions if they are galaxy "build" numbers. --- lib/galaxy/tools/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index e1359d5a8395..6600f61a779d 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -663,7 +663,14 @@ def _view(self): @property def version_object(self): - return packaging.version.parse(self.version) + version = self.version + version_split = version.split("+", 1) + if len(version_split) == 2 and version_split[1].startswith("galaxy") and version_split[1] != "galaxy": + # Per PEP-440 this would be sorted lexicographically if not separated by a '.', this forces a numeric sort + # if the characters after 'galaxy' are an integer, otherwise the outcome will be the same. + version_split[1] = "galaxy." + version_split[1][6:] + version = "+".join(version_split) + return packaging.version.parse(version) @property def sa_session(self): From 7a1be66d4ed8f5079b7d07773712455d342e6a14 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 17 Mar 2022 11:42:17 -0400 Subject: [PATCH 2/2] Don't add `.` to `+galaxy` local version if there is already a `.` --- lib/galaxy/tools/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 6600f61a779d..1cb14228184f 100644 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -665,7 +665,10 @@ def _view(self): def version_object(self): version = self.version version_split = version.split("+", 1) - if len(version_split) == 2 and version_split[1].startswith("galaxy") and version_split[1] != "galaxy": + if (len(version_split) == 2 + and version_split[1].startswith("galaxy") + and version_split[1] != "galaxy" + and version_split[1][6] != "."): # Per PEP-440 this would be sorted lexicographically if not separated by a '.', this forces a numeric sort # if the characters after 'galaxy' are an integer, otherwise the outcome will be the same. version_split[1] = "galaxy." + version_split[1][6:]