Skip to content

Commit

Permalink
gdaltools: SIP APIv2 update (error when paths defined in Settings dia…
Browse files Browse the repository at this point in the history
…log)
  • Loading branch information
brushtyler committed Jun 27, 2013
1 parent 7f99708 commit edd0cdd
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions python/plugins/GdalTools/tools/GdalTools_utils.py
Expand Up @@ -289,16 +289,15 @@ def getVectorFields(vectorFile):
def getRasterSRS( parent, fileName ):
processSRS = QProcess( parent )
processSRS.start( "gdalinfo", [fileName], QIODevice.ReadOnly )
arr = QByteArray()
arr = ''
if processSRS.waitForFinished():
arr = processSRS.readAllStandardOutput()
arr = str(processSRS.readAllStandardOutput())
processSRS.close()

arr = str(arr)
if arr == '':
return ''

info = string.split( arr, sep="\n" )
info = arr.splitlines()
if len(info) == 0:
return ''

Expand All @@ -312,18 +311,17 @@ def getRasterSRS( parent, fileName ):
def getRasterExtent(parent, fileName):
processSRS = QProcess( parent )
processSRS.start( "gdalinfo", [fileName], QIODevice.ReadOnly )
arr = QByteArray()
arr = ''
if processSRS.waitForFinished():
arr = processSRS.readAllStandardOutput()
arr = str(processSRS.readAllStandardOutput())
processSRS.close()
arr = str(arr)

if arr == '':
return

ulCoord = lrCoord = ''
xUL = yLR = xLR = yUL = 0
info = string.split( arr, sep="\n" )
info = arr.splitlines()
for elem in info:
m = re.match("^Upper\sLeft.*", elem)
if m:
Expand Down Expand Up @@ -824,23 +822,15 @@ def setProcessEnvironment(process):
envval = os.getenv(name)
if envval == None or envval == "":
envval = str(val)
elif not QString( envval ).split( sep ).contains( val, Qt.CaseInsensitive ):
elif (platform.system() == "Windows" and val.lower() not in envval.lower().split( sep )) or
(platform.system() != "Windows" and val not in envval.split( sep )):
envval += "%s%s" % (sep, str(val))
else:
envval = None

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

if False: # not needed because os.putenv() has already updated the environment for new child processes
env = QProcess.systemEnvironment()
if env.contains( QRegExp( "^%s=(.*)" % name, Qt.CaseInsensitive ) ):
env.replaceInStrings( QRegExp( "^%s=(.*)" % name, Qt.CaseInsensitive ), "%s=\\1%s%s" % (name, sep, gdalPath) )
else:
env.append( "%s=%s" % (name, val))
process.setEnvironment( env )


def setMacOSXDefaultEnvironment():
# fix bug #3170: many GDAL Tools don't work in OS X standalone

Expand Down

0 comments on commit edd0cdd

Please sign in to comment.