Skip to content

Commit af04c79

Browse files
committed
[Plugin Installer] More uniform behaviour when comparing versions: always exclude any non-numeric parts
1 parent 040e9d5 commit af04c79

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/pyplugin_installer/version_compare.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
ALPHA, BETA, RC, PREVIEW and TRUNK which make the version number lower.
4747
"""
4848

49+
import re
50+
4951
# ------------------------------------------------------------------------ #
5052
def normalizeVersion(s):
5153
""" remove possible prefix from given string and convert to uppercase """
@@ -169,9 +171,9 @@ def splitVersion(s):
169171

170172
def isCompatible(curVer, minVer, maxVer=None):
171173
""" Compare current QGIS version with qgisMinVersion and qgisMaxVersion """
172-
minVer = splitVersion(minVer)
173-
maxVer = splitVersion(maxVer)
174-
curVer = splitVersion( curVer.split("-")[0] )
174+
minVer = splitVersion( re.sub(r'[^0-9.]+', '', minVer) )
175+
maxVer = splitVersion( re.sub(r'[^0-9.]+', '', maxVer) )
176+
curVer = splitVersion( re.sub(r'[^0-9.]+', '', curVer) )
175177

176178
if not minVer or not curVer:
177179
return False

0 commit comments

Comments
 (0)