Merge pull request #63367 from qgis/backport-63240-to-release-3_44

[Backport release-3_44] processing: Call gdal_merge instead of gdal_merge.py
This commit is contained in:
Alexander Bruy 2025-09-30 06:46:16 +01:00 committed by GitHub
commit 086dd9bc36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View File

@ -266,6 +266,19 @@ class merge(GdalAlgorithm):
arguments.append(list_file)
return [
self.commandName() + (".bat" if isWindows() else ".py"),
self.commandName() + merge.command_ext(),
GdalUtils.escapeAndJoin(arguments),
]
@staticmethod
def command_ext() -> str:
"""
Returns the gdal_merge command extension
"""
if isWindows():
return ".bat"
if GdalUtils.version() < 3090000:
return ".py"
return ""

View File

@ -4556,6 +4556,8 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
alg = merge()
alg.initAlgorithm()
merge_command = alg.commandName() + alg.command_ext()
with tempfile.TemporaryDirectory() as outdir:
# this algorithm creates temporary text file with input layers
# so we strip its path, leaving only filename
@ -4567,7 +4569,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
self.assertEqual(
cmd,
[
"gdal_merge.py",
merge_command,
"-ot Float32 -of GTiff "
+ "-o "
+ outdir
@ -4586,7 +4588,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
self.assertEqual(
cmd,
[
"gdal_merge.py",
merge_command,
"-separate -ot Float32 -of GTiff "
+ "-o "
+ outdir
@ -4610,7 +4612,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
self.assertEqual(
cmd,
[
"gdal_merge.py",
merge_command,
"-ot Float32 -of GTiff -tap -ps 0.1 0.1 "
+ "-o "
+ outdir
@ -4634,7 +4636,7 @@ class TestGdalRasterAlgorithms(QgisTestCase, AlgorithmsTestBase.AlgorithmsTest):
self.assertEqual(
cmd,
[
"gdal_merge.py",
merge_command,
"-a_nodata -9999.0 -ot Float32 -of GTiff "
+ "-o "
+ outdir