Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
processing/gdal: use batch files instead of modules on windows
(cherry picked from commit 570972b)
- Loading branch information
|
@@ -71,7 +71,7 @@ def groupId(self): |
|
|
return 'rasterprojections' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_edit' |
|
|
return 'gdal_edit.bat' if isWindows() else 'gdal_edit.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context) |
|
@@ -88,16 +88,9 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
|
|
|
arguments.append(fileName) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
self.setOutputValue(self.OUTPUT, fileName) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
|
|
|
|
def postProcessAlgorithm(self, context, feedback): |
|
|
# get output value |
|
|
|
@@ -109,7 +109,7 @@ def groupId(self): |
|
|
return 'rasteranalysis' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_fillnodata' |
|
|
return 'gdal_fillnodata.bat' if isWindows() else 'gdal_fillnodata.py' |
|
|
|
|
|
def flags(self): |
|
|
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral |
|
@@ -155,11 +155,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(raster.source()) |
|
|
arguments.append(out) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -150,7 +150,7 @@ def groupId(self): |
|
|
return 'rastermiscellaneous' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal2tiles' |
|
|
return 'gdal2tiles.bat' if isWindows() else 'gdal2tiles.py' |
|
|
|
|
|
def flags(self): |
|
|
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral |
|
@@ -223,11 +223,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(inLayer.source()) |
|
|
arguments.append(self.parameterAsString(parameters, self.OUTPUT, context)) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -69,7 +69,7 @@ def groupId(self): |
|
|
return 'rasterconversion' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal2xyz' |
|
|
return 'gdal2xyz.bat' if isWindows() else 'gdal2xyz.py' |
|
|
|
|
|
def flags(self): |
|
|
return super().flags() | QgsProcessingAlgorithm.FlagDisplayNameIsLiteral |
|
@@ -89,11 +89,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(raster.source()) |
|
|
arguments.append(self.parameterAsFileOutput(parameters, self.OUTPUT, context)) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -179,7 +179,7 @@ def groupId(self): |
|
|
return 'rastermiscellaneous' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_calc' if isWindows() else 'gdal_calc.py' |
|
|
return 'gdal_calc.bat' if isWindows() else 'gdal_calc' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) |
|
|
|
@@ -127,7 +127,7 @@ def icon(self): |
|
|
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'merge.png')) |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_merge' |
|
|
return 'gdal_merge.bat' is isWindows() else 'gdal_merge.py' |
Check failure
on line 130 in python/plugins/processing/algs/gdal/merge.py
GitHub Actions / Python Lint
python/plugins/processing/algs/gdal/merge.py#L130
|
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context) |
|
@@ -173,11 +173,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append('--optfile') |
|
|
arguments.append(list_file) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -104,7 +104,7 @@ def groupId(self): |
|
|
return 'rastermiscellaneous' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_pansharpen' |
|
|
return 'gdal_pansharpen.bat' if isWindows() else 'gdal_pansharpen.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
spectral = self.parameterAsRasterLayer(parameters, self.SPECTRAL, context) |
|
@@ -136,11 +136,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
extra = self.parameterAsString(parameters, self.EXTRA, context) |
|
|
arguments.append(extra) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ['python3', '-m', self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -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' |
|
|
return 'pct2rgb.bat' if isWindows() else 'pct2rgb.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments = [] |
|
@@ -97,11 +97,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
if self.parameterAsBoolean(parameters, self.RGBA, context): |
|
|
arguments.append('-rgba') |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -91,7 +91,7 @@ def icon(self): |
|
|
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'polygonize.png')) |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_polygonize' |
|
|
return 'gdal_polygonize.bat' if isWindows() else 'gdal_polygonize.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments = [] |
|
@@ -124,11 +124,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(layerName) |
|
|
arguments.append(self.parameterAsString(parameters, self.FIELD, context)) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -139,7 +139,7 @@ def groupId(self): |
|
|
return 'rasteranalysis' |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_proximity' |
|
|
return 'gdal_proximity.bat' if isWindows() else 'gdal_proximity.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
inLayer = self.parameterAsRasterLayer(parameters, self.INPUT, context) |
|
@@ -196,11 +196,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(inLayer.source()) |
|
|
arguments.append(out) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -159,7 +159,7 @@ def groupId(self): |
|
|
return 'rastermiscellaneous' |
|
|
|
|
|
def commandName(self): |
|
|
return "gdal_retile" |
|
|
return "gdal_retile.bat" if isWindows() else "gdal_retile.py" |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments = [] |
|
@@ -214,11 +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) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -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' |
|
|
return 'rgb2pct.bat' if isWindows() else 'rgb2pct.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments = [] |
|
@@ -90,11 +90,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(raster.source()) |
|
|
arguments.append(out) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |
|
@@ -94,7 +94,7 @@ def icon(self): |
|
|
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'sieve.png')) |
|
|
|
|
|
def commandName(self): |
|
|
return 'gdal_sieve' |
|
|
return 'gdal_sieve.bat' if isWindows() else 'gdal_sieve.py' |
|
|
|
|
|
def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments = [] |
|
@@ -130,11 +130,4 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): |
|
|
arguments.append(raster.source()) |
|
|
arguments.append(out) |
|
|
|
|
|
if isWindows(): |
|
|
commands = ["python3", "-m", self.commandName()] |
|
|
else: |
|
|
commands = [self.commandName() + '.py'] |
|
|
|
|
|
commands.append(GdalUtils.escapeAndJoin(arguments)) |
|
|
|
|
|
return commands |
|
|
return [self.commandName(), GdalUtils.escapeAndJoin(arguments)] |