mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[BACKPORT] find python on OSX (partially fix #3097)
don't overwrite PATH env var, but append to it.
This commit is contained in:
parent
5193f60d2a
commit
99edf1de05
@ -760,3 +760,9 @@ class Version:
|
||||
|
||||
def __str__(self):
|
||||
return ".".join(self.vers)
|
||||
|
||||
|
||||
# setup the default MacOs path
|
||||
#if platform.system() == "Darwin" and getGdalPath().isEmpty():
|
||||
# setGdalPath( u"/Library/Frameworks/GDAL.framework/Versions/%s/Programs" % str(GdalConfig.version())[:3] )
|
||||
|
||||
|
@ -24,16 +24,19 @@ class GdalToolsBaseDialog(QDialog, Ui_Dialog):
|
||||
self.process = QProcess(self)
|
||||
gdalPath = Utils.getGdalPath()
|
||||
if not gdalPath.isEmpty():
|
||||
sep = ";" if platform.system() == "Windows" else ":"
|
||||
env = self.process.environment()
|
||||
if env.isEmpty():
|
||||
#env << "PATH=" + gdalPath
|
||||
os.putenv( "PATH", str( gdalPath ) )
|
||||
# process.enviroment() is probably not supported (MacOS?),
|
||||
# use os.putenv() instead
|
||||
path = os.getenv("PATH")
|
||||
if path != "":
|
||||
path += sep
|
||||
path += gdalPath
|
||||
os.putenv( "PATH", path )
|
||||
else:
|
||||
if platform.system() == "Windows":
|
||||
env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1;" + gdalPath )
|
||||
else:
|
||||
env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1:" + gdalPath )
|
||||
self.process.setEnvironment( env )
|
||||
env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1%s%s" % (sep, gdalPath) )
|
||||
self.process.setEnvironment( env )
|
||||
self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError)
|
||||
self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user