|
32 | 32 | import sys |
33 | 33 | import os |
34 | 34 | import codecs |
| 35 | +import re |
35 | 36 | try: |
36 | 37 | import configparser |
37 | 38 | except ImportError: |
|
41 | 42 | except ImportError: |
42 | 43 | from imp import reload |
43 | 44 | import qgis.utils |
44 | | -from qgis.core import Qgis, QgsNetworkAccessManager, QgsApplication |
| 45 | +from qgis.core import QgsNetworkAccessManager, QgsApplication |
45 | 46 | from qgis.gui import QgsMessageBar |
46 | 47 | from qgis.utils import iface, plugin_paths |
47 | | -from .version_compare import compareVersions, normalizeVersion, isCompatible |
| 48 | +from .version_compare import pyQgisVersion, compareVersions, normalizeVersion, isCompatible |
48 | 49 |
|
49 | 50 |
|
50 | 51 | """ |
@@ -212,12 +213,8 @@ def allUnavailable(self): |
212 | 213 | # ----------------------------------------- # |
213 | 214 | def urlParams(self): |
214 | 215 | """ return GET parameters to be added to every request """ |
215 | | - # v = str(Qgis.QGIS_VERSION_INT) |
216 | | - # TODO: make this proper again after 3.0 release, by uncommenting |
217 | | - # the line below and removing the other return line: |
218 | | - # return "?qgis=%d.%d" % (int(v[0]), int(v[1:3])) |
219 | | - # TODO: Do the same for lines 469-472 |
220 | | - return "?qgis=3.0" |
| 216 | + # Strip down the point release segment from the version string |
| 217 | + return "?qgis=%s" % re.sub('\.\d*$', '', pyQgisVersion()) |
221 | 218 |
|
222 | 219 | # ----------------------------------------- # |
223 | 220 | def setRepositoryData(self, reposName, key, value): |
@@ -466,10 +463,7 @@ def xmlDownloaded(self): |
466 | 463 | qgisMaximumVersion = qgisMinimumVersion[0] + ".99" |
467 | 464 | # if compatible, add the plugin to the list |
468 | 465 | if not pluginNodes.item(i).firstChildElement("disabled").text().strip().upper() in ["TRUE", "YES"]: |
469 | | - # TODO: make this proper again after 3.0 release, by uncommenting the line below and removing the next line |
470 | | - # TODO: Do the same for lines 215-220 |
471 | | - # if isCompatible(Qgis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion): |
472 | | - if isCompatible("3.0", qgisMinimumVersion, qgisMaximumVersion): |
| 466 | + if isCompatible(pyQgisVersion(), qgisMinimumVersion, qgisMaximumVersion): |
473 | 467 | # add the plugin to the cache |
474 | 468 | plugins.addFromRepository(plugin) |
475 | 469 | self.mRepositories[reposName]["state"] = 2 |
@@ -618,7 +612,7 @@ def pluginMetadata(fct): |
618 | 612 | if not qgisMaximumVersion: |
619 | 613 | qgisMaximumVersion = qgisMinimumVersion[0] + ".99" |
620 | 614 | # if compatible, add the plugin to the list |
621 | | - if not isCompatible(Qgis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion): |
| 615 | + if not isCompatible(pyQgisVersion(), qgisMinimumVersion, qgisMaximumVersion): |
622 | 616 | error = "incompatible" |
623 | 617 | errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion) |
624 | 618 | elif not os.path.exists(metadataFile): |
|
0 commit comments