Skip to content

Commit

Permalink
[processing][saga] Allow saga algorithms to be run under SAGA 7.3,
Browse files Browse the repository at this point in the history
but show a huge obnoxious "NOT OFFICIALLY SUPPORTED" warning

SAGA 7.3 is the new SAGA LTR, so we eventually need to move towards this.

But adding full support is going to be a painstaking tedious process. So
allow users to use this combination, but totally at their own risk.

TODO: Make SAGA provider a 3rd party plugin only and save QGIS core dev sanity ;)
(cherry picked from commit d969e41)
  • Loading branch information
nyalldawson committed Dec 16, 2019
1 parent d6afeb6 commit d7144ea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
Expand Up @@ -40,6 +40,7 @@
os.path.split(os.path.dirname(__file__))[0], os.pardir))

REQUIRED_VERSION = '2.3.'
BETA_SUPPORT_VERSION = '7.3.'


class SagaAlgorithmProvider(QgsProcessingProvider):
Expand Down Expand Up @@ -78,18 +79,24 @@ def setActive(self, active):

def canBeActivated(self):
version = SagaUtils.getInstalledVersion(True)
if version is not None and version.startswith(REQUIRED_VERSION):
if version is not None and (version.startswith(REQUIRED_VERSION) or version.startswith(BETA_SUPPORT_VERSION)):
return True
return False

def warningMessage(self):
version = SagaUtils.getInstalledVersion(True)
if version is not None and version.startswith(BETA_SUPPORT_VERSION):
return self.tr('SAGA version {} is not officially supported - algorithms may encounter issues').format(version)
return ''

def loadAlgorithms(self):
version = SagaUtils.getInstalledVersion(True)
if version is None:
QgsMessageLog.logMessage(self.tr('Problem with SAGA installation: SAGA was not found or is not correctly installed'),
self.tr('Processing'), Qgis.Critical)
return

if not version.startswith(REQUIRED_VERSION):
if not version.startswith(REQUIRED_VERSION) and not version.startswith(BETA_SUPPORT_VERSION):
QgsMessageLog.logMessage(self.tr('Problem with SAGA installation: unsupported SAGA version (found: {}, required: {}).').format(version, REQUIRED_VERSION),
self.tr('Processing'),
Qgis.Critical)
Expand Down

0 comments on commit d7144ea

Please sign in to comment.