From eea4eda6a35f1a06f84f198249b51b169144c46f Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Sun, 10 Feb 2019 21:06:56 +0100 Subject: [PATCH] osgeo4w: fix b6293f23c8c (fixes #21210) --- python/plugins/processing/algs/gdal/AssignProjection.py | 8 ++++++-- python/plugins/processing/algs/gdal/fillnodata.py | 7 +++++-- python/plugins/processing/algs/gdal/gdal2tiles.py | 7 +++++-- python/plugins/processing/algs/gdal/gdal2xyz.py | 7 +++++-- python/plugins/processing/algs/gdal/merge.py | 7 +++++-- python/plugins/processing/algs/gdal/pct2rgb.py | 7 +++++-- python/plugins/processing/algs/gdal/polygonize.py | 7 +++++-- python/plugins/processing/algs/gdal/proximity.py | 7 +++++-- python/plugins/processing/algs/gdal/retile.py | 7 +++++-- python/plugins/processing/algs/gdal/rgb2pct.py | 7 +++++-- python/plugins/processing/algs/gdal/sieve.py | 7 +++++-- 11 files changed, 56 insertions(+), 22 deletions(-) diff --git a/python/plugins/processing/algs/gdal/AssignProjection.py b/python/plugins/processing/algs/gdal/AssignProjection.py index 64859d1a782..f8722a9e707 100644 --- a/python/plugins/processing/algs/gdal/AssignProjection.py +++ b/python/plugins/processing/algs/gdal/AssignProjection.py @@ -92,9 +92,13 @@ class AssignProjection(GdalAlgorithm): arguments.append(fileName) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) self.setOutputValue(self.OUTPUT, fileName) + return commands diff --git a/python/plugins/processing/algs/gdal/fillnodata.py b/python/plugins/processing/algs/gdal/fillnodata.py index b5cf2c1399c..76c7b383182 100644 --- a/python/plugins/processing/algs/gdal/fillnodata.py +++ b/python/plugins/processing/algs/gdal/fillnodata.py @@ -130,8 +130,11 @@ class fillnodata(GdalAlgorithm): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/gdal2tiles.py b/python/plugins/processing/algs/gdal/gdal2tiles.py index 935dad13fa4..26c10c8e977 100644 --- a/python/plugins/processing/algs/gdal/gdal2tiles.py +++ b/python/plugins/processing/algs/gdal/gdal2tiles.py @@ -229,8 +229,11 @@ class gdal2tiles(GdalAlgorithm): arguments.append(inLayer.source()) arguments.append(self.parameterAsString(parameters, self.OUTPUT, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/gdal2xyz.py b/python/plugins/processing/algs/gdal/gdal2xyz.py index 03372f35dda..c12c69e1956 100644 --- a/python/plugins/processing/algs/gdal/gdal2xyz.py +++ b/python/plugins/processing/algs/gdal/gdal2xyz.py @@ -94,8 +94,11 @@ class gdal2xyz(GdalAlgorithm): arguments.append(raster.source()) arguments.append(self.parameterAsFileOutput(parameters, self.OUTPUT, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/merge.py b/python/plugins/processing/algs/gdal/merge.py index 6960949d287..c3871aaa982 100644 --- a/python/plugins/processing/algs/gdal/merge.py +++ b/python/plugins/processing/algs/gdal/merge.py @@ -166,8 +166,11 @@ class merge(GdalAlgorithm): arguments.append('--optfile') arguments.append(list_file) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/pct2rgb.py b/python/plugins/processing/algs/gdal/pct2rgb.py index 4556c783bfb..7c7b165df76 100644 --- a/python/plugins/processing/algs/gdal/pct2rgb.py +++ b/python/plugins/processing/algs/gdal/pct2rgb.py @@ -103,8 +103,11 @@ class pct2rgb(GdalAlgorithm): if self.parameterAsBool(parameters, self.RGBA, context): arguments.append('-rgba') - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/polygonize.py b/python/plugins/processing/algs/gdal/polygonize.py index 93040677856..ff519bd4bc6 100644 --- a/python/plugins/processing/algs/gdal/polygonize.py +++ b/python/plugins/processing/algs/gdal/polygonize.py @@ -116,8 +116,11 @@ class polygonize(GdalAlgorithm): arguments.append(layerName) arguments.append(self.parameterAsString(parameters, self.FIELD, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/proximity.py b/python/plugins/processing/algs/gdal/proximity.py index 8138fcd5986..d5a0f7be114 100644 --- a/python/plugins/processing/algs/gdal/proximity.py +++ b/python/plugins/processing/algs/gdal/proximity.py @@ -187,8 +187,11 @@ class proximity(GdalAlgorithm): arguments.append(inLayer.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/retile.py b/python/plugins/processing/algs/gdal/retile.py index 7e4f6154569..d38a0a2218a 100644 --- a/python/plugins/processing/algs/gdal/retile.py +++ b/python/plugins/processing/algs/gdal/retile.py @@ -209,8 +209,11 @@ class retile(GdalAlgorithm): layers = [l.source() for l in self.parameterAsLayerList(parameters, self.INPUT, context)] arguments.extend(layers) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/rgb2pct.py b/python/plugins/processing/algs/gdal/rgb2pct.py index 118aff5cbfd..36c83963615 100644 --- a/python/plugins/processing/algs/gdal/rgb2pct.py +++ b/python/plugins/processing/algs/gdal/rgb2pct.py @@ -95,8 +95,11 @@ class rgb2pct(GdalAlgorithm): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/sieve.py b/python/plugins/processing/algs/gdal/sieve.py index 6d8ae59b1b2..a7a80ef7e44 100644 --- a/python/plugins/processing/algs/gdal/sieve.py +++ b/python/plugins/processing/algs/gdal/sieve.py @@ -120,8 +120,11 @@ class sieve(GdalAlgorithm): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands