Skip to content

Commit 85c67be

Browse files
committedMay 9, 2013
fix GDAL path defaults for OS X
1 parent 5f06eec commit 85c67be

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed
 

‎python/plugins/GdalTools/tools/GdalTools_utils.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import os
4242
# to know the os
4343
import platform
44+
import sys
4445

4546
# Escapes arguments and return them joined in a string
4647
def escapeAndJoin(strList):
@@ -849,8 +850,8 @@ def setMacOSXDefaultEnvironment():
849850
qgis_standalone_gdal_path = u"%s/Frameworks/GDAL.framework" % qgis_app
850851

851852
# path to the GDAL framework when installed as external framework
852-
# TODO adjust this for gdal 1.10
853-
gdal_bin_path = u"/Library/Frameworks/GDAL.framework/Versions/%s/Programs" % str(GdalConfig.version())[:3]
853+
gdal_versionsplit = str(GdalConfig.version()).split('.')
854+
gdal_base_path = u"/Library/Frameworks/GDAL.framework/Versions/%s.%s" % (gdal_versionsplit[0], gdal_versionsplit[1])
854855

855856
if os.path.exists( qgis_standalone_gdal_path ): # qgis standalone
856857
# GDAL executables are in the QGis bin folder
@@ -859,11 +860,18 @@ def setMacOSXDefaultEnvironment():
859860
# GDAL pymods are in the QGis python folder
860861
if getGdalPymodPath().isEmpty():
861862
setGdalPymodPath( qgis_python )
863+
# GDAL help is in the framework folder
864+
if getHelpPath().isEmpty():
865+
setHelpPath( u"%s/Resources/doc" % qgis_standalone_gdal_path )
862866

863-
elif os.path.exists( gdal_bin_path ):
864-
# GDAL executables are in the GDAL framework Programs folder
867+
elif os.path.exists( gdal_base_path ):
868+
# all GDAL parts are in the GDAL framework folder
865869
if getGdalBinPath().isEmpty():
866-
setGdalBinPath( gdal_bin_path )
870+
setGdalBinPath( u"%s/Programs" % gdal_base_path )
871+
if getGdalPymodPath().isEmpty():
872+
setGdalPymodPath( u"%s/Python/%s.%s/site-packages" % (gdal_base_path, sys.version_info[0], sys.version_info[1]) )
873+
if getHelpPath().isEmpty():
874+
setHelpPath( u"%s/Resources/doc" % gdal_base_path )
867875

868876

869877
# setup the MacOSX path to both GDAL executables and python modules

0 commit comments

Comments
 (0)
Please sign in to comment.