26
26
__revision__ = '$Format:%H$'
27
27
28
28
import os
29
+ import platform
29
30
import stat
30
31
import subprocess
31
32
import time
@@ -59,7 +60,7 @@ def sagaBatchJobFilename():
59
60
60
61
def findSagaFolder ():
61
62
folder = None
62
- if isMac ():
63
+ if isMac () or platform . system () == 'FreeBSD' :
63
64
testfolder = os .path .join (QgsApplication .prefixPath (), 'bin' )
64
65
if os .path .exists (os .path .join (testfolder , 'saga_cmd' )):
65
66
folder = testfolder
@@ -84,7 +85,7 @@ def findSagaFolder():
84
85
85
86
86
87
def sagaPath ():
87
- if not isWindows () and not isMac ():
88
+ if not isWindows () and not isMac () and not platform . system () == 'FreeBSD' :
88
89
return ''
89
90
90
91
folder = findSagaFolder ()
@@ -102,7 +103,7 @@ def createSagaBatchJobFileFromSagaCommands(commands):
102
103
fout .write ('set SAGA=' + sagaPath () + '\n ' )
103
104
fout .write ('set SAGA_MLB=' + os .path .join (sagaPath (), 'modules' ) + '\n ' )
104
105
fout .write ('PATH=%PATH%;%SAGA%;%SAGA_MLB%\n ' )
105
- elif isMac ():
106
+ elif isMac () or platform . system () == 'FreeBSD' :
106
107
fout .write ('export SAGA_MLB=' + os .path .join (sagaPath (), '../lib/saga' ) + '\n ' )
107
108
fout .write ('export PATH=' + sagaPath () + ':$PATH\n ' )
108
109
else :
@@ -124,7 +125,7 @@ def getInstalledVersion(runSaga=False):
124
125
125
126
if isWindows ():
126
127
commands = [os .path .join (sagaPath (), "saga_cmd.exe" ), "-v" ]
127
- elif isMac ():
128
+ elif isMac () or platform . system () == 'FreeBSD' :
128
129
commands = [os .path .join (sagaPath (), "saga_cmd -v" )]
129
130
else :
130
131
# for Linux use just one string instead of separated parameters as the list
@@ -140,7 +141,7 @@ def getInstalledVersion(runSaga=False):
140
141
stderr = subprocess .STDOUT ,
141
142
universal_newlines = True ,
142
143
) 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
144
145
time .sleep (1 )
145
146
try :
146
147
lines = proc .stdout .readlines ()
0 commit comments