Skip to content

Commit edd0cdd

Browse files
committed
gdaltools: SIP APIv2 update (error when paths defined in Settings dialog)
1 parent 7f99708 commit edd0cdd

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

python/plugins/GdalTools/tools/GdalTools_utils.py

+8-18
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,15 @@ def getVectorFields(vectorFile):
289289
def getRasterSRS( parent, fileName ):
290290
processSRS = QProcess( parent )
291291
processSRS.start( "gdalinfo", [fileName], QIODevice.ReadOnly )
292-
arr = QByteArray()
292+
arr = ''
293293
if processSRS.waitForFinished():
294-
arr = processSRS.readAllStandardOutput()
294+
arr = str(processSRS.readAllStandardOutput())
295295
processSRS.close()
296296

297-
arr = str(arr)
298297
if arr == '':
299298
return ''
300299

301-
info = string.split( arr, sep="\n" )
300+
info = arr.splitlines()
302301
if len(info) == 0:
303302
return ''
304303

@@ -312,18 +311,17 @@ def getRasterSRS( parent, fileName ):
312311
def getRasterExtent(parent, fileName):
313312
processSRS = QProcess( parent )
314313
processSRS.start( "gdalinfo", [fileName], QIODevice.ReadOnly )
315-
arr = QByteArray()
314+
arr = ''
316315
if processSRS.waitForFinished():
317-
arr = processSRS.readAllStandardOutput()
316+
arr = str(processSRS.readAllStandardOutput())
318317
processSRS.close()
319-
arr = str(arr)
320318

321319
if arr == '':
322320
return
323321

324322
ulCoord = lrCoord = ''
325323
xUL = yLR = xLR = yUL = 0
326-
info = string.split( arr, sep="\n" )
324+
info = arr.splitlines()
327325
for elem in info:
328326
m = re.match("^Upper\sLeft.*", elem)
329327
if m:
@@ -824,23 +822,15 @@ def setProcessEnvironment(process):
824822
envval = os.getenv(name)
825823
if envval == None or envval == "":
826824
envval = str(val)
827-
elif not QString( envval ).split( sep ).contains( val, Qt.CaseInsensitive ):
825+
elif (platform.system() == "Windows" and val.lower() not in envval.lower().split( sep )) or
826+
(platform.system() != "Windows" and val not in envval.split( sep )):
828827
envval += "%s%s" % (sep, str(val))
829828
else:
830829
envval = None
831830

832831
if envval != None:
833832
os.putenv( name, envval )
834833

835-
if False: # not needed because os.putenv() has already updated the environment for new child processes
836-
env = QProcess.systemEnvironment()
837-
if env.contains( QRegExp( "^%s=(.*)" % name, Qt.CaseInsensitive ) ):
838-
env.replaceInStrings( QRegExp( "^%s=(.*)" % name, Qt.CaseInsensitive ), "%s=\\1%s%s" % (name, sep, gdalPath) )
839-
else:
840-
env.append( "%s=%s" % (name, val))
841-
process.setEnvironment( env )
842-
843-
844834
def setMacOSXDefaultEnvironment():
845835
# fix bug #3170: many GDAL Tools don't work in OS X standalone
846836

0 commit comments

Comments
 (0)