Skip to content
Permalink
Browse files

[Plugin Installer] More uniform behaviour when comparing versions: al…

…ways exclude any non-numeric parts
  • Loading branch information
borysiasty committed Sep 12, 2013
1 parent 040e9d5 commit af04c794fc0d119e261b36c043b728251e234b26
Showing with 5 additions and 3 deletions.
  1. +5 −3 python/pyplugin_installer/version_compare.py
@@ -46,6 +46,8 @@
ALPHA, BETA, RC, PREVIEW and TRUNK which make the version number lower.
"""

import re

# ------------------------------------------------------------------------ #
def normalizeVersion(s):
""" remove possible prefix from given string and convert to uppercase """
@@ -169,9 +171,9 @@ def splitVersion(s):

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

if not minVer or not curVer:
return False

0 comments on commit af04c79

Please sign in to comment.
You can’t perform that action at this time.