Skip to content
Permalink
Browse files

Add FreeBSD for SagaUtils

  • Loading branch information
lbartoletti authored and nyalldawson committed Mar 6, 2019
1 parent 825c240 commit f87c447d34ba55a894d750d209b4b555b142ce5d
Showing with 6 additions and 5 deletions.
  1. +6 −5 python/plugins/processing/algs/saga/SagaUtils.py
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
import platform
import stat
import subprocess
import time
@@ -59,7 +60,7 @@ def sagaBatchJobFilename():

def findSagaFolder():
folder = None
if isMac():
if isMac() or platform.system() == 'FreeBSD':
testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
folder = testfolder
@@ -84,7 +85,7 @@ def findSagaFolder():


def sagaPath():
if not isWindows() and not isMac():
if not isWindows() and not isMac() and not platform.system() == 'FreeBSD':
return ''

folder = findSagaFolder()
@@ -102,7 +103,7 @@ def createSagaBatchJobFileFromSagaCommands(commands):
fout.write('set SAGA=' + sagaPath() + '\n')
fout.write('set SAGA_MLB=' + os.path.join(sagaPath(), 'modules') + '\n')
fout.write('PATH=%PATH%;%SAGA%;%SAGA_MLB%\n')
elif isMac():
elif isMac() or platform.system() == 'FreeBSD':
fout.write('export SAGA_MLB=' + os.path.join(sagaPath(), '../lib/saga') + '\n')
fout.write('export PATH=' + sagaPath() + ':$PATH\n')
else:
@@ -124,7 +125,7 @@ def getInstalledVersion(runSaga=False):

if isWindows():
commands = [os.path.join(sagaPath(), "saga_cmd.exe"), "-v"]
elif isMac():
elif isMac() or platform.system() == 'FreeBSD':
commands = [os.path.join(sagaPath(), "saga_cmd -v")]
else:
# for Linux use just one string instead of separated parameters as the list
@@ -140,7 +141,7 @@ def getInstalledVersion(runSaga=False):
stderr=subprocess.STDOUT,
universal_newlines=True,
) as proc:
if isMac(): # This trick avoids having an uninterrupted system call exception if SAGA is not installed
if isMac() or platform.system() == 'FreeBSD': # This trick avoids having an uninterrupted system call exception if SAGA is not installed
time.sleep(1)
try:
lines = proc.stdout.readlines()

0 comments on commit f87c447

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