Skip to content

Commit f87c447

Browse files
lbartolettinyalldawson
authored andcommitted
Add FreeBSD for SagaUtils
1 parent 825c240 commit f87c447

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

python/plugins/processing/algs/saga/SagaUtils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
__revision__ = '$Format:%H$'
2727

2828
import os
29+
import platform
2930
import stat
3031
import subprocess
3132
import time
@@ -59,7 +60,7 @@ def sagaBatchJobFilename():
5960

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

8586

8687
def sagaPath():
87-
if not isWindows() and not isMac():
88+
if not isWindows() and not isMac() and not platform.system() == 'FreeBSD':
8889
return ''
8990

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

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

0 commit comments

Comments
 (0)