Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing][gdal] Partially revert 570972b
- gdal_calc command is gdal_calc.py, not gdal_calc
- commandName() method is used for more than just the command line
generation, so move extension handling to getConsoleCommands() only
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Feb 27, 2021
1 parent 8784771 commit d79c8f3
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/AssignProjection.py
Expand Up @@ -71,7 +71,7 @@ def groupId(self):
return 'rasterprojections'

def commandName(self):
return 'gdal_edit.bat' if isWindows() else 'gdal_edit.py'
return 'gdal_edit'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context)
Expand All @@ -90,7 +90,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

self.setOutputValue(self.OUTPUT, fileName)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]

def postProcessAlgorithm(self, context, feedback):
# get output value
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/fillnodata.py
Expand Up @@ -109,7 +109,7 @@ def groupId(self):
return 'rasteranalysis'

def commandName(self):
return 'gdal_fillnodata.bat' if isWindows() else 'gdal_fillnodata.py'
return 'gdal_fillnodata'

def flags(self):
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral
Expand Down Expand Up @@ -155,4 +155,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(raster.source())
arguments.append(out)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/gdal2tiles.py
Expand Up @@ -150,7 +150,7 @@ def groupId(self):
return 'rastermiscellaneous'

def commandName(self):
return 'gdal2tiles.bat' if isWindows() else 'gdal2tiles.py'
return 'gdal2tiles'

def flags(self):
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral
Expand Down Expand Up @@ -223,4 +223,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(inLayer.source())
arguments.append(self.parameterAsString(parameters, self.OUTPUT, context))

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/gdal2xyz.py
Expand Up @@ -69,7 +69,7 @@ def groupId(self):
return 'rasterconversion'

def commandName(self):
return 'gdal2xyz.bat' if isWindows() else 'gdal2xyz.py'
return 'gdal2xyz'

def flags(self):
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral
Expand All @@ -89,4 +89,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(raster.source())
arguments.append(self.parameterAsFileOutput(parameters, self.OUTPUT, context))

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/gdalcalc.py
Expand Up @@ -179,7 +179,7 @@ def groupId(self):
return 'rastermiscellaneous'

def commandName(self):
return 'gdal_calc.bat' if isWindows() else 'gdal_calc'
return 'gdal_calc'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
Expand Down Expand Up @@ -265,4 +265,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('--outfile')
arguments.append(out)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/merge.py
Expand Up @@ -127,7 +127,7 @@ def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'merge.png'))

def commandName(self):
return 'gdal_merge.bat' if isWindows() else 'gdal_merge.py'
return 'gdal_merge'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
Expand Down Expand Up @@ -173,4 +173,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('--optfile')
arguments.append(list_file)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/pansharp.py
Expand Up @@ -104,7 +104,7 @@ def groupId(self):
return 'rastermiscellaneous'

def commandName(self):
return 'gdal_pansharpen.bat' if isWindows() else 'gdal_pansharpen.py'
return 'gdal_pansharpen'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
spectral = self.parameterAsRasterLayer(parameters, self.SPECTRAL, context)
Expand Down Expand Up @@ -136,4 +136,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
extra = self.parameterAsString(parameters, self.EXTRA, context)
arguments.append(extra)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/pct2rgb.py
Expand Up @@ -74,7 +74,7 @@ def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', '8-to-24-bits.png'))

def commandName(self):
return 'pct2rgb.bat' if isWindows() else 'pct2rgb.py'
return 'pct2rgb'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
Expand All @@ -97,4 +97,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
if self.parameterAsBoolean(parameters, self.RGBA, context):
arguments.append('-rgba')

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/polygonize.py
Expand Up @@ -91,7 +91,7 @@ def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'polygonize.png'))

def commandName(self):
return 'gdal_polygonize.bat' if isWindows() else 'gdal_polygonize.py'
return 'gdal_polygonize'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
Expand Down Expand Up @@ -124,4 +124,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(layerName)
arguments.append(self.parameterAsString(parameters, self.FIELD, context))

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/proximity.py
Expand Up @@ -139,7 +139,7 @@ def groupId(self):
return 'rasteranalysis'

def commandName(self):
return 'gdal_proximity.bat' if isWindows() else 'gdal_proximity.py'
return 'gdal_proximity'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context)
Expand Down Expand Up @@ -196,4 +196,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(inLayer.source())
arguments.append(out)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/retile.py
Expand Up @@ -159,7 +159,7 @@ def groupId(self):
return 'rastermiscellaneous'

def commandName(self):
return "gdal_retile.bat" if isWindows() else "gdal_retile.py"
return "gdal_retile"

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
Expand Down Expand Up @@ -214,4 +214,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
layers = [l.source() for l in self.parameterAsLayerList(parameters, self.INPUT, context)]
arguments.extend(layers)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/rgb2pct.py
Expand Up @@ -72,7 +72,7 @@ def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', '24-to-8-bits.png'))

def commandName(self):
return 'rgb2pct.bat' if isWindows() else 'rgb2pct.py'
return 'rgb2pct'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
Expand All @@ -90,4 +90,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(raster.source())
arguments.append(out)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/gdal/sieve.py
Expand Up @@ -94,7 +94,7 @@ def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'sieve.png'))

def commandName(self):
return 'gdal_sieve.bat' if isWindows() else 'gdal_sieve.py'
return 'gdal_sieve'

def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments = []
Expand Down Expand Up @@ -130,4 +130,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append(raster.source())
arguments.append(out)

return [self.commandName(), GdalUtils.escapeAndJoin(arguments)]
return [self.commandName() + ('.bat' if isWindows() else '.py'), GdalUtils.escapeAndJoin(arguments)]

0 comments on commit d79c8f3

Please sign in to comment.