From 98eb5f65a0209bbd3220e5689a8a14e1b74d8df8 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 7 Nov 2023 16:47:05 +0100 Subject: [PATCH] Python utilities: make gdal_edit, gdal_pansharp, gdal_retile and ogr_layer_algebra return 0 error code when invoked with --version switch Fixes https://github.com/conda-forge/gdal-feedstock/pull/835#pullrequestreview-1718014342 --- swig/python/gdal-utils/osgeo_utils/gdal_edit.py | 2 +- swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py | 2 +- swig/python/gdal-utils/osgeo_utils/gdal_retile.py | 2 +- swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py | 2 +- swig/python/gdal-utils/osgeo_utils/ogrmerge.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_edit.py b/swig/python/gdal-utils/osgeo_utils/gdal_edit.py index 6d760207fc7e..341c89e8dc3a 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_edit.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_edit.py @@ -89,7 +89,7 @@ def gdal_edit(argv): argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: - return 2 + return 0 datasetname = None srs = None diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py b/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py index b9bd8cc1477f..7c640c294759 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py @@ -71,7 +71,7 @@ def Usage(isError): def main(argv=sys.argv): argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: - return -1 + return 0 pan_name = None spectral_names = [] diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_retile.py b/swig/python/gdal-utils/osgeo_utils/gdal_retile.py index 2c697b055f1b..40a9f9d973da 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_retile.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_retile.py @@ -948,7 +948,7 @@ def main(args=None, g=None): args = sys.argv argv = gdal.GeneralCmdLineProcessor(args) if argv is None: - return 1 + return 0 # Parse command line arguments. i = 1 diff --git a/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py b/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py index 1dd43e71b6d5..e85b9a3016aa 100644 --- a/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py +++ b/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py @@ -193,7 +193,7 @@ def main(argv=sys.argv): argv = ogr.GeneralCmdLineProcessor(argv) if argv is None: - return 1 + return 0 # Parse command line arguments. i = 1 diff --git a/swig/python/gdal-utils/osgeo_utils/ogrmerge.py b/swig/python/gdal-utils/osgeo_utils/ogrmerge.py index cc930926adea..d7b3bfaff7b8 100644 --- a/swig/python/gdal-utils/osgeo_utils/ogrmerge.py +++ b/swig/python/gdal-utils/osgeo_utils/ogrmerge.py @@ -1209,7 +1209,7 @@ def are_sources_gpkg(): def main(argv=sys.argv): argv = ogr.GeneralCmdLineProcessor(argv) if argv is None: - return 1 + return 0 return process(argv[1:])