Skip to content
Permalink
Browse files

fix autodetect of saga & otb on OS X, also detect bundled grass, saga…

… & otb
  • Loading branch information
kyngchaos committed Apr 7, 2013
1 parent 5edc9df commit baedeb27ed5f3b4db3cdaf2030fd1d053a7c0faf
@@ -24,6 +24,7 @@
__revision__ = '$Format:%H$'

import os
from qgis.core import QgsApplication
from PyQt4.QtCore import *
import traceback
import subprocess
@@ -87,15 +88,17 @@ def grassPath():
folder = folder + os.sep + subfolder
break
else:
return "/Applications/GRASS-6.4.app/Contents/MacOS"
folder = os.path.join(str(QgsApplication.prefixPath()), "grass")
if not os.path.isdir(folder):
folder = "/Applications/GRASS-6.4.app/Contents/MacOS"

return folder

@staticmethod
def grassHelpPath():
folder = SextanteConfig.getSetting(GrassUtils.GRASS_HELP_FOLDER)
if folder == None or folder == "":
if SextanteUtils.isWindows():
if SextanteUtils.isWindows() or SextanteUtils.isMac():
testfolders = [os.path.join(GrassUtils.grassPath(), "docs", "html")]
else:
testfolders = ['/usr/share/doc/grass-doc/html']
@@ -24,6 +24,7 @@
__revision__ = '$Format:%H$'

import os
from qgis.core import QgsApplication
import subprocess
from sextante.core.SextanteConfig import SextanteConfig
from sextante.core.SextanteLog import SextanteLog
@@ -42,8 +43,18 @@ def otbPath():
if folder == None:
folder = ""

if os.path.exists("/usr/bin/otbcli"):
folder = "/usr/bin"
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "otbcli")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "otbcli")):
folder = testfolder
else:
testfolder = "/usr/bin"
if os.path.exists(os.path.join(testfolder, "otbcli")):
folder = testfolder
return folder

@staticmethod
@@ -52,9 +63,18 @@ def otbLibPath():
if folder == None:
folder =""

linuxstandardpath = "/usr/lib/otb/applications"
if os.path.exists(linuxstandardpath):
folder = linuxstandardpath
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "lib/otb/applications")
if os.path.exists(testfolder):
folder = testfolder
else:
testfolder = "/usr/local/lib/otb/applications"
if os.path.exists(testfolder):
folder = testfolder
else:
testfolder = "/usr/lib/otb/applications"
if os.path.exists(testfolder):
folder = testfolder
return folder

@staticmethod
@@ -64,6 +64,14 @@ def sagaPath():
if folder == None:
folder =""

if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
return folder

@staticmethod
@@ -76,8 +84,11 @@ def createSagaBatchJobFileFromSagaCommands(commands):
fout = open(SagaUtils.sagaBatchJobFilename(), "w")
if SextanteUtils.isWindows():
fout.write("set SAGA=" + SagaUtils.sagaPath() + "\n");
fout.write("set SAGA_MLB=" + SagaUtils.sagaPath()+ os.sep + "modules" + "\n");
fout.write("set SAGA_MLB=" + SagaUtils.sagaPath() + os.sep + "modules" + "\n");
fout.write("PATH=PATH;%SAGA%;%SAGA_MLB%\n");
elif SextanteUtils.isMac():
fout.write("export SAGA_MLB=" + SagaUtils.sagaPath() + "/../lib/saga\n");
fout.write("export PATH=" + SagaUtils.sagaPath() + ":$PATH\n");
else:
pass
for command in commands:

0 comments on commit baedeb2

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