@@ -45,25 +45,23 @@ class GdalUtils:
45
45
46
46
@staticmethod
47
47
def runGdal (commands , progress ):
48
- envval = unicode ( os .getenv ('PATH' ) )
48
+ envval = os .getenv ('PATH' )
49
49
# We need to give some extra hints to get things picked up on OS X
50
- if platform .system () == 'Darwin' :
51
- if os .path .isfile (os .path .join (QgsApplication .prefixPath (), "bin" , "gdalinfo" )):
52
- # Looks like there's a bundled gdal. Let's use it.
53
- os .environ ['PATH' ] = "%s%s%s" % (os .path .join (QgsApplication .prefixPath (), "bin" ), os .pathsep , envval )
54
- os .environ ['DYLD_LIBRARY_PATH' ] = os .path .join (QgsApplication .prefixPath (), "lib" )
55
- else :
56
- # Nothing internal. Let's see if we can find it elsewhere.
57
- settings = QSettings ()
58
- path = unicode (settings .value ('/GdalTools/gdalPath' , '' ))
59
- envval += '%s%s' % (os .pathsep , path )
60
- os .putenv ('PATH' , envval )
50
+ isDarwin = False
51
+ try :
52
+ isDarwin = platform .system () == 'Darwin'
53
+ except IOError : # https://travis-ci.org/m-kuhn/QGIS#L1493-L1526
54
+ pass
55
+ if isDarwin and os .path .isfile (os .path .join (QgsApplication .prefixPath (), "bin" , "gdalinfo" )):
56
+ # Looks like there's a bundled gdal. Let's use it.
57
+ os .environ ['PATH' ] = "{}{}{}" .format (os .path .join (QgsApplication .prefixPath (), "bin" ), os .pathsep , envval )
58
+ os .environ ['DYLD_LIBRARY_PATH' ] = os .path .join (QgsApplication .prefixPath (), "lib" )
61
59
else :
62
60
# Other platforms should use default gdal finder codepath
63
61
settings = QSettings ()
64
- path = unicode ( settings .value ('/GdalTools/gdalPath' , '' ) )
62
+ path = settings .value ('/GdalTools/gdalPath' , '' )
65
63
if not path .lower () in envval .lower ().split (os .pathsep ):
66
- envval += '%s%s' % (os .pathsep , path )
64
+ envval += '{}{}' . format (os .pathsep , path )
67
65
os .putenv ('PATH' , envval )
68
66
69
67
loglines = []
0 commit comments