mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[sextante] added better autoconfiguration for external apps' paths
This commit is contained in:
parent
b938724f1d
commit
bb97fc8b55
@ -34,7 +34,6 @@ from sextante.core.SextanteUtils import SextanteUtils, mkdir
|
||||
from sextante.core.SextanteLog import SextanteLog
|
||||
import stat
|
||||
import shutil
|
||||
import plugin_installer
|
||||
|
||||
class GrassUtils:
|
||||
|
||||
@ -76,16 +75,14 @@ class GrassUtils:
|
||||
|
||||
folder = SextanteConfig.getSetting(GrassUtils.GRASS_FOLDER)
|
||||
if folder == None:
|
||||
if SextanteUtils.isWindows():
|
||||
folder = plugin_installer.__file__
|
||||
idx = folder.find('qgis')
|
||||
folder = folder[:idx] + "grass"
|
||||
if not os.path.isdir(folder):
|
||||
return ""
|
||||
for subfolder in os.listdir(folder):
|
||||
if subfolder.startswith("grass"):
|
||||
folder = folder + os.sep + subfolder
|
||||
break
|
||||
if SextanteUtils.isWindows():
|
||||
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
|
||||
testfolder = os.path.join(testfolder, "grass")
|
||||
if os.path.isdir(testfolder):
|
||||
for subfolder in os.listdir(testfolder):
|
||||
if subfolder.startswith("grass"):
|
||||
folder = os.path.join(testfolder, subfolder)
|
||||
break
|
||||
else:
|
||||
folder = os.path.join(str(QgsApplication.prefixPath()), "grass")
|
||||
if not os.path.isdir(folder):
|
||||
@ -97,10 +94,8 @@ class GrassUtils:
|
||||
def grassWinShell():
|
||||
folder = SextanteConfig.getSetting(GrassUtils.GRASS_WIN_SHELL)
|
||||
if folder == None:
|
||||
folder = plugin_installer.__file__
|
||||
idx = folder.find('qgis')
|
||||
folder = folder[:idx] + "msys"
|
||||
|
||||
folder = os.path.dirname(str(QgsApplication.prefixPath()))
|
||||
folder = os.path.join(folder, "msys")
|
||||
return folder
|
||||
|
||||
@staticmethod
|
||||
|
@ -35,7 +35,7 @@ class OTBAlgorithmProvider(AlgorithmProvider):
|
||||
|
||||
def __init__(self):
|
||||
AlgorithmProvider.__init__(self)
|
||||
self.activate = False
|
||||
self.activate = True
|
||||
self.createAlgsList()
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ class OTBUtils:
|
||||
folder = SextanteConfig.getSetting(OTBUtils.OTB_FOLDER)
|
||||
if folder == None:
|
||||
folder = ""
|
||||
|
||||
#try to configure the path automatically
|
||||
if SextanteUtils.isMac():
|
||||
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
|
||||
if os.path.exists(os.path.join(testfolder, "otbcli")):
|
||||
@ -51,6 +51,13 @@ class OTBUtils:
|
||||
testfolder = "/usr/local/bin"
|
||||
if os.path.exists(os.path.join(testfolder, "otbcli")):
|
||||
folder = testfolder
|
||||
elif SextanteUtils.isWindows():
|
||||
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
|
||||
testfolder = os.path.dirname(testfolder)
|
||||
testfolder = os.path.join(testfolder, "bin")
|
||||
path = os.path.join(testfolder, "otbcli.bat")
|
||||
if os.path.exists(path):
|
||||
folder = testfolder
|
||||
else:
|
||||
testfolder = "/usr/bin"
|
||||
if os.path.exists(os.path.join(testfolder, "otbcli")):
|
||||
@ -62,7 +69,7 @@ class OTBUtils:
|
||||
folder = SextanteConfig.getSetting(OTBUtils.OTB_LIB_FOLDER)
|
||||
if folder == None:
|
||||
folder =""
|
||||
|
||||
#try to configure the path automatically
|
||||
if SextanteUtils.isMac():
|
||||
testfolder = os.path.join(str(QgsApplication.prefixPath()), "lib/otb/applications")
|
||||
if os.path.exists(testfolder):
|
||||
@ -70,11 +77,17 @@ class OTBUtils:
|
||||
else:
|
||||
testfolder = "/usr/local/lib/otb/applications"
|
||||
if os.path.exists(testfolder):
|
||||
folder = testfolder
|
||||
folder = testfolder
|
||||
elif SextanteUtils.isWindows():
|
||||
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
|
||||
testfolder = os.path.join(testfolder, "orfeotoolbox")
|
||||
testfolder = os.path.join(testfolder, "applications")
|
||||
if os.path.exists(testfolder):
|
||||
folder = testfolder
|
||||
else:
|
||||
testfolder = "/usr/lib/otb/applications"
|
||||
if os.path.exists(testfolder):
|
||||
folder = testfolder
|
||||
folder = testfolder
|
||||
return folder
|
||||
|
||||
@staticmethod
|
||||
|
@ -39,7 +39,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
|
||||
def __init__(self):
|
||||
AlgorithmProvider.__init__(self)
|
||||
self.activate = False
|
||||
self.activate = True
|
||||
self.createAlgsList() #preloading algorithms to speed up
|
||||
|
||||
def initializeSettings(self):
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from sextante.tests.TestData import points
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -28,6 +27,7 @@ import os
|
||||
import stat
|
||||
import traceback
|
||||
import subprocess
|
||||
from sextante.tests.TestData import points
|
||||
from sextante.core.SextanteUtils import SextanteUtils
|
||||
from sextante.core.SextanteConfig import SextanteConfig
|
||||
from sextante.core.SextanteLog import SextanteLog
|
||||
@ -63,15 +63,20 @@ class SagaUtils:
|
||||
folder = SextanteConfig.getSetting(SagaUtils.SAGA_FOLDER)
|
||||
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"
|
||||
#try to auto-configure the 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
|
||||
elif SextanteUtils.isWindows():
|
||||
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
|
||||
testfolder = os.path.join(testfolder, "saga")
|
||||
if os.path.exists(os.path.join(testfolder, "saga_cmd.exe")):
|
||||
folder = testfolder
|
||||
return folder
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user