Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 af04c79
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/pyplugin_installer/version_compare.py
Expand Up @@ -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 """
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af04c79

Please sign in to comment.