Skip to content

Commit

Permalink
[Plugin Installer] More uniform behaviour when comparing versions: al…
Browse files Browse the repository at this point in the history
…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. ALPHA, BETA, RC, PREVIEW and TRUNK which make the version number lower.
""" """


import re

# ------------------------------------------------------------------------ # # ------------------------------------------------------------------------ #
def normalizeVersion(s): def normalizeVersion(s):
""" remove possible prefix from given string and convert to uppercase """ """ 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): def isCompatible(curVer, minVer, maxVer=None):
""" Compare current QGIS version with qgisMinVersion and qgisMaxVersion """ """ Compare current QGIS version with qgisMinVersion and qgisMaxVersion """
minVer = splitVersion(minVer) minVer = splitVersion( re.sub(r'[^0-9.]+', '', minVer) )
maxVer = splitVersion(maxVer) maxVer = splitVersion( re.sub(r'[^0-9.]+', '', maxVer) )
curVer = splitVersion( curVer.split("-")[0] ) curVer = splitVersion( re.sub(r'[^0-9.]+', '', curVer) )


if not minVer or not curVer: if not minVer or not curVer:
return False return False
Expand Down

0 comments on commit af04c79

Please sign in to comment.