From be2db8ba65f0741b3d3e8f1a4e4b6e3b2b619328 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 22 Sep 2024 18:51:31 +0200 Subject: [PATCH 1/3] pcidsk.py: add requirements to PNG driver --- autotest/gdrivers/pcidsk.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autotest/gdrivers/pcidsk.py b/autotest/gdrivers/pcidsk.py index d8c7f24b168c..0a4acba081f0 100755 --- a/autotest/gdrivers/pcidsk.py +++ b/autotest/gdrivers/pcidsk.py @@ -60,6 +60,7 @@ def test_pcidsk_1(): # Test lossless copying (16, multiband) via Create(). +@pytest.mark.require_driver("PNG") def test_pcidsk_2(): tst = gdaltest.GDALTest("PCIDSK", "png/rgba16.png", 2, 2042) @@ -222,6 +223,7 @@ def test_pcidsk_5(tmp_path): # Test FILE interleaving. +@pytest.mark.require_driver("PNG") def test_pcidsk_8(): tst = gdaltest.GDALTest( @@ -284,6 +286,7 @@ def test_pcidsk_10(): # Test INTERLEAVING=TILED interleaving. +@pytest.mark.require_driver("PNG") def test_pcidsk_11(): tst = gdaltest.GDALTest( @@ -297,6 +300,7 @@ def test_pcidsk_11(): tst.testCreate() +@pytest.mark.require_driver("PNG") def test_pcidsk_11_v1(): tst = gdaltest.GDALTest( @@ -310,6 +314,7 @@ def test_pcidsk_11_v1(): tst.testCreate() +@pytest.mark.require_driver("PNG") def test_pcidsk_11_v2(): tst = gdaltest.GDALTest( @@ -327,6 +332,7 @@ def test_pcidsk_11_v2(): # Test INTERLEAVING=TILED interleaving and COMPRESSION=RLE +@pytest.mark.require_driver("PNG") def test_pcidsk_12(): tst = gdaltest.GDALTest( @@ -340,6 +346,7 @@ def test_pcidsk_12(): tst.testCreate() +@pytest.mark.require_driver("PNG") def test_pcidsk_12_v1(): tst = gdaltest.GDALTest( @@ -358,6 +365,7 @@ def test_pcidsk_12_v1(): tst.testCreate() +@pytest.mark.require_driver("PNG") def test_pcidsk_12_v2(): tst = gdaltest.GDALTest( From 3b150490cc043a9159d3d0ea7f38e236d75ee41e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 22 Sep 2024 18:36:29 +0200 Subject: [PATCH 2/3] Allow to partially disable VRT driver with GDAL_ENABLE_VRT_DRIVER=OFF but still enable it by default even if GDAL_BUILD_OPTIONAL_DRIVERS=OFF Creation side is still available, but Open() not Also enable GTI driver to be separately enabled/disabled, and buildable as a plugin (if built as a plugin, gdaladdo --partial-refresh-from-source-timestamp won't work) --- apps/CMakeLists.txt | 5 + apps/gdaladdo.cpp | 12 +++ autotest/alg/cutline.py | 5 + autotest/alg/warp.py | 5 + autotest/cpp/test_gdal.cpp | 6 ++ autotest/cpp/test_gdal_pixelfn.cpp | 9 ++ autotest/gcore/gdal_stats.py | 20 ++++ autotest/gcore/geoloc.py | 4 + autotest/gcore/interpolateatpoint.py | 4 + autotest/gcore/mask.py | 4 + autotest/gcore/numpy_rw.py | 8 ++ autotest/gcore/overviewds.py | 9 ++ autotest/gcore/pixfun.py | 5 + autotest/gcore/testnonboundtoswig.py | 4 + autotest/gcore/tiff_ovr.py | 16 +++ autotest/gcore/tiff_read.py | 4 + autotest/gcore/tiff_write.py | 100 ++++++++++++++++++ autotest/gcore/transformer.py | 60 +++++++++++ autotest/gcore/vrt_read.py | 4 + autotest/gcore/vrtmisc.py | 6 ++ autotest/gcore/vsistdin.py | 4 + autotest/gdrivers/aaigrid.py | 4 + autotest/gdrivers/derived.py | 7 ++ autotest/gdrivers/dimap.py | 5 + autotest/gdrivers/ecw.py | 4 + autotest/gdrivers/ehdr.py | 4 + autotest/gdrivers/ers.py | 4 + autotest/gdrivers/gpkg.py | 4 + autotest/gdrivers/grib.py | 3 +- autotest/gdrivers/gta.py | 4 + autotest/gdrivers/gti.py | 20 +++- autotest/gdrivers/hfa.py | 4 + autotest/gdrivers/jp2openjpeg.py | 12 +++ autotest/gdrivers/jpeg.py | 4 + autotest/gdrivers/kmlsuperoverlay.py | 12 +++ autotest/gdrivers/mrf.py | 4 + autotest/gdrivers/netcdf.py | 12 +++ autotest/gdrivers/netcdf_multidim.py | 4 + autotest/gdrivers/nitf.py | 24 +++++ autotest/gdrivers/pdf.py | 28 +++++ autotest/gdrivers/prf.py | 4 + autotest/gdrivers/sigdem.py | 5 + autotest/gdrivers/test_validate_jp2.py | 8 ++ autotest/gdrivers/vrtderived.py | 4 + autotest/gdrivers/vrtfilt.py | 5 + autotest/gdrivers/vrtlut.py | 5 + autotest/gdrivers/vrtmask.py | 5 + autotest/gdrivers/vrtmultidim.py | 4 + autotest/gdrivers/vrtovr.py | 5 + autotest/gdrivers/vrtpansharpen.py | 5 + autotest/gdrivers/vrtprocesseddataset.py | 5 + autotest/gdrivers/vrtrawlink.py | 5 + autotest/gdrivers/vrtwarp.py | 5 + autotest/gdrivers/wms.py | 4 + autotest/pymod/gdaltest.py | 5 + autotest/pyscripts/gdal2tiles/test_logger.py | 6 ++ autotest/pyscripts/gdal2tiles/test_vsimem.py | 6 ++ autotest/pyscripts/test_gdal2tiles.py | 13 ++- autotest/pyscripts/test_gdal_pansharpen.py | 10 +- autotest/pyscripts/test_gdalattachpct.py | 5 + autotest/pyscripts/test_gdalbuildvrtofvrt.py | 4 + autotest/pyscripts/test_gdalinfo_py.py | 5 + autotest/utilities/test_gdal_create.py | 4 + autotest/utilities/test_gdal_translate.py | 20 ++++ autotest/utilities/test_gdal_translate_lib.py | 12 +++ autotest/utilities/test_gdaladdo.py | 21 ++++ autotest/utilities/test_gdalbuildvrt.py | 14 ++- autotest/utilities/test_gdalbuildvrt_lib.py | 14 +++ autotest/utilities/test_gdaldem.py | 12 +++ autotest/utilities/test_gdaldem_lib.py | 8 ++ autotest/utilities/test_gdalinfo.py | 8 ++ autotest/utilities/test_gdallocationinfo.py | 4 + autotest/utilities/test_gdalmdiminfo.py | 8 ++ autotest/utilities/test_gdalmdimtranslate.py | 8 ++ .../utilities/test_gdalmdimtranslate_lib.py | 48 +++++++++ autotest/utilities/test_gdalwarp.py | 12 +++ autotest/utilities/test_gdalwarp_lib.py | 12 +++ frmts/CMakeLists.txt | 19 +++- frmts/gdalallregister.cpp | 5 +- frmts/gti/CMakeLists.txt | 26 +++++ frmts/{vrt => gti}/data/gdaltileindex.xsd | 0 frmts/{vrt => gti}/gdaltileindexdataset.cpp | 9 +- frmts/vrt/CMakeLists.txt | 6 +- frmts/vrt/vrt_priv.h | 4 +- frmts/vrt/vrtdataset.h | 4 +- frmts/vrt/vrtdriver.cpp | 5 +- gcore/gdal_priv.h | 3 +- ogr/ogrsf_frmts/generic/ogrwarpedlayer.h | 2 +- 88 files changed, 842 insertions(+), 26 deletions(-) create mode 100644 frmts/gti/CMakeLists.txt rename frmts/{vrt => gti}/data/gdaltileindex.xsd (100%) rename frmts/{vrt => gti}/gdaltileindexdataset.cpp (99%) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 4ce116ae1b01..94bbc93a8694 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -147,6 +147,11 @@ if (BUILD_APPS) target_compile_definitions(${UTILCMD} PRIVATE -DSUPPORTS_WMAIN) endif () target_link_libraries(${UTILCMD} PRIVATE $ utils_common) + + if (NOT GDAL_ENABLE_DRIVER_GTI OR GDAL_ENABLE_DRIVER_GTI_PLUGIN) + target_compile_definitions(${UTILCMD} PRIVATE -DGTI_DRIVER_DISABLED_OR_PLUGIN) + endif() + endforeach () install(TARGETS ${APPS_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/apps/gdaladdo.cpp b/apps/gdaladdo.cpp index 32d1ffa873b7..3f03c122bd18 100644 --- a/apps/gdaladdo.cpp +++ b/apps/gdaladdo.cpp @@ -311,6 +311,17 @@ static bool PartialRefreshFromSourceTimestamp( } } } +#ifdef GTI_DRIVER_DISABLED_OR_PLUGIN + else if (poDS->GetDriver() && + EQUAL(poDS->GetDriver()->GetDescription(), "GTI")) + { + CPLError(CE_Failure, CPLE_NotSupported, + "--partial-refresh-from-source-timestamp only works on a GTI " + "dataset if the GTI driver is not built as a plugin, " + "but in core library"); + return false; + } +#else else if (auto poGTIDS = GDALDatasetCastToGTIDataset(poDS)) { regions = GTIGetSourcesMoreRecentThan(poGTIDS, sStatVRTOvr.st_mtime); @@ -320,6 +331,7 @@ static bool PartialRefreshFromSourceTimestamp( static_cast(region.nDstXSize) * region.nDstYSize; } } +#endif else { CPLError(CE_Failure, CPLE_AppDefined, diff --git a/autotest/alg/cutline.py b/autotest/alg/cutline.py index de27180d5e20..e4bc8bb3c569 100755 --- a/autotest/alg/cutline.py +++ b/autotest/alg/cutline.py @@ -36,6 +36,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### diff --git a/autotest/alg/warp.py b/autotest/alg/warp.py index fae126885e55..d8ab607e0165 100755 --- a/autotest/alg/warp.py +++ b/autotest/alg/warp.py @@ -40,6 +40,11 @@ import gdaltest import pytest +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + from osgeo import gdal, osr ############################################################################### diff --git a/autotest/cpp/test_gdal.cpp b/autotest/cpp/test_gdal.cpp index c5046797e65f..675ec33396b1 100644 --- a/autotest/cpp/test_gdal.cpp +++ b/autotest/cpp/test_gdal.cpp @@ -3114,6 +3114,12 @@ TEST_F(test_gdal, GDALCachedPixelAccessor) // (https://github.com/OSGeo/gdal/issues/5989) TEST_F(test_gdal, VRTCachingOpenOptions) { + if (GDALGetMetadataItem(GDALGetDriverByName("VRT"), GDAL_DMD_OPENOPTIONLIST, + nullptr) == nullptr) + { + GTEST_SKIP() << "VRT driver Open() missing"; + } + class TestRasterBand : public GDALRasterBand { protected: diff --git a/autotest/cpp/test_gdal_pixelfn.cpp b/autotest/cpp/test_gdal_pixelfn.cpp index 6adfbc567636..cb23e556585f 100644 --- a/autotest/cpp/test_gdal_pixelfn.cpp +++ b/autotest/cpp/test_gdal_pixelfn.cpp @@ -170,6 +170,15 @@ struct test_gdal_pixelfn : public ::testing::Test src_ += SEP; src_ += "pixelfn.vrt"; } + + void SetUp() override + { + if (GDALGetMetadataItem(GDALGetDriverByName("VRT"), + GDAL_DMD_OPENOPTIONLIST, nullptr) == nullptr) + { + GTEST_SKIP() << "VRT driver Open() missing"; + } + } }; // Test constant parameters in a custom pixel function diff --git a/autotest/gcore/gdal_stats.py b/autotest/gcore/gdal_stats.py index 95137a355879..7a7dbe69a3f9 100755 --- a/autotest/gcore/gdal_stats.py +++ b/autotest/gcore/gdal_stats.py @@ -180,6 +180,10 @@ def test_stats_nan_3(): # and complex source nodata (#3576) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_stats_nan_4(): ds = gdal.Open("data/nan32_nodata.vrt") @@ -197,6 +201,10 @@ def test_stats_nan_4(): # and complex source nodata (nan must be translated to 0 then) (#3576) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_stats_nan_5(): ds = gdal.Open("data/nan32_nodata_nan_to_zero.vrt") @@ -213,6 +221,10 @@ def test_stats_nan_5(): # Test reading a warped VRT with nan as src nodata and dest nodata (#3576) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_stats_nan_6(): ds = gdal.Open("data/nan32_nodata_warp.vrt") @@ -229,6 +241,10 @@ def test_stats_nan_6(): # Test reading a warped VRT with nan as src nodata and 0 as dest nodata (#3576) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_stats_nan_7(): ds = gdal.Open("data/nan32_nodata_warp_nan_to_zero.vrt") @@ -245,6 +261,10 @@ def test_stats_nan_7(): # Test reading a warped VRT with zero as src nodata and nan as dest nodata (#3576) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_stats_nan_8(): ds = gdal.Open("data/nan32_nodata_warp_zero_to_nan.vrt") diff --git a/autotest/gcore/geoloc.py b/autotest/gcore/geoloc.py index d27be4319703..dcee7f5f82e4 100755 --- a/autotest/gcore/geoloc.py +++ b/autotest/gcore/geoloc.py @@ -41,6 +41,10 @@ # Verify warped result. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_geoloc_1(): tst = gdaltest.GDALTest("VRT", "warpsst.vrt", 1, 63034) diff --git a/autotest/gcore/interpolateatpoint.py b/autotest/gcore/interpolateatpoint.py index 3dffd4c8b3f1..767a144e54dd 100755 --- a/autotest/gcore/interpolateatpoint.py +++ b/autotest/gcore/interpolateatpoint.py @@ -302,6 +302,10 @@ def test_interpolateatpoint_complex_float(): assert res == pytest.approx((34.433130 - 36.741504j), 1e-4) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_interpolateatpoint_big_complex(): # The purpose of this test is to check that the algorithm implementation # works for bigger values above the first block of 64x64 pixels. diff --git a/autotest/gcore/mask.py b/autotest/gcore/mask.py index 180521e11b65..19570c59dbb2 100755 --- a/autotest/gcore/mask.py +++ b/autotest/gcore/mask.py @@ -72,6 +72,10 @@ def test_mask_1(): # Verify the checksum and flags for "nodata" case. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_mask_2(): ds = gdal.Open("data/byte.vrt") diff --git a/autotest/gcore/numpy_rw.py b/autotest/gcore/numpy_rw.py index d4451ab0dcf7..52258f7dadeb 100755 --- a/autotest/gcore/numpy_rw.py +++ b/autotest/gcore/numpy_rw.py @@ -732,6 +732,10 @@ def test_numpy_rw_18(): # The VRT references a non existing TIF file, but using the proxy pool dataset API (#2837) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_numpy_rw_failure_in_readasarray(): ds = gdal.Open("data/idontexist2.vrt") @@ -964,6 +968,10 @@ def test_numpy_rw_band_read_as_array_error_cases(): # Test that we can get an error (#5374) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_numpy_rw_band_read_as_array_getlasterrormsg(): ds = gdal.Open( diff --git a/autotest/gcore/overviewds.py b/autotest/gcore/overviewds.py index a3a8a11a4540..e4d567c714cd 100755 --- a/autotest/gcore/overviewds.py +++ b/autotest/gcore/overviewds.py @@ -32,6 +32,7 @@ import shutil import struct +import gdaltest import pytest from osgeo import gdal @@ -250,6 +251,10 @@ def test_overviewds_4(tmp_path): # Test GEOLOCATION +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_overviewds_5(tmp_path): shutil.copy("data/sstgeo.tif", tmp_path) @@ -296,6 +301,10 @@ def test_overviewds_5(tmp_path): # Test VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_overviewds_6(tmp_path): shutil.copy("data/byte.tif", tmp_path) diff --git a/autotest/gcore/pixfun.py b/autotest/gcore/pixfun.py index 57fcf99f3fb3..d8dc001eba66 100755 --- a/autotest/gcore/pixfun.py +++ b/autotest/gcore/pixfun.py @@ -35,6 +35,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + # All tests will be skipped if numpy is unavailable. numpy = pytest.importorskip("numpy") diff --git a/autotest/gcore/testnonboundtoswig.py b/autotest/gcore/testnonboundtoswig.py index 8979d26f4512..5d964a2fc0c4 100755 --- a/autotest/gcore/testnonboundtoswig.py +++ b/autotest/gcore/testnonboundtoswig.py @@ -291,6 +291,10 @@ def my_pyDerivedPixelFunc( return 0 +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_testnonboundtoswig_VRTDerivedBands(): DerivedPixelFuncType = ctypes.CFUNCTYPE( diff --git a/autotest/gcore/tiff_ovr.py b/autotest/gcore/tiff_ovr.py index d047ea29843e..7dd49bd0e7cf 100755 --- a/autotest/gcore/tiff_ovr.py +++ b/autotest/gcore/tiff_ovr.py @@ -122,6 +122,10 @@ def mfloat32_tif(tmp_path): yield dst_fname +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_ovr_1(mfloat32_tif, both_endian): ds = gdal.Open(mfloat32_tif) @@ -151,6 +155,10 @@ def test_tiff_ovr_1(mfloat32_tif, both_endian): # Open target file in update mode, and create internal overviews. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_ovr_3(mfloat32_tif, both_endian): src_ds = gdal.Open(mfloat32_tif, gdal.GA_Update) @@ -531,6 +539,10 @@ def test_tiff_ovr_12(tmp_path, both_endian): # Test gaussian resampling +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_ovr_13(mfloat32_tif, both_endian): ds = gdal.Open(mfloat32_tif) @@ -608,6 +620,10 @@ def test_tiff_ovr_15(tmp_path, both_endian): # Test mode resampling on non-byte dataset +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_ovr_16(tmp_path, both_endian): tif_fname = str(tmp_path / "ovr16.tif") diff --git a/autotest/gcore/tiff_read.py b/autotest/gcore/tiff_read.py index 3a18f98579a5..6856094b7b59 100755 --- a/autotest/gcore/tiff_read.py +++ b/autotest/gcore/tiff_read.py @@ -5189,6 +5189,10 @@ def test_tiff_read_webp_lossless_rgba_alpha_fully_opaque(): # Test complex scenario of https://github.com/OSGeo/gdal/issues/9563 +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_creation_option("GTiff", "JPEG") def test_tiff_read_jpeg_cached_multi_range_issue_9563(tmp_vsimem): diff --git a/autotest/gcore/tiff_write.py b/autotest/gcore/tiff_write.py index c7bcdef00130..88f3caac637f 100755 --- a/autotest/gcore/tiff_write.py +++ b/autotest/gcore/tiff_write.py @@ -212,6 +212,10 @@ def test_tiff_write_4(): # Write a file with GCPs. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_5(): src_ds = gdal.Open("data/gcps.vrt") @@ -434,6 +438,10 @@ def test_tiff_write_14(): # file using the PROFILE creation option with CreateCopy() +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_15(): ds_in = gdal.Open("data/byte.vrt") @@ -484,6 +492,10 @@ def test_tiff_write_15(): # file using the PROFILE creation option with Create() +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_16(): ds_in = gdal.Open("data/byte.vrt") @@ -548,6 +560,10 @@ def test_tiff_write_16(): # Test writing a TIFF with an RPC tag. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_17(): # Translate RPC controlled data to GeoTIFF. @@ -608,6 +624,10 @@ def test_tiff_write_17(): # case (#3996) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_17_disable_readdir(): with gdal.config_option("GDAL_DISABLE_READDIR_ON_OPEN", "TRUE"): test_tiff_write_17() @@ -617,6 +637,10 @@ def test_tiff_write_17_disable_readdir(): # Test writing a TIFF with an RPB file and IMD file. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_18(): # Translate RPC controlled data to GeoTIFF. @@ -713,6 +737,10 @@ def test_tiff_write_imd_with_space_in_values(): # case (#3996) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_18_disable_readdir(): with gdal.config_option("GDAL_DISABLE_READDIR_ON_OPEN", "TRUE"): test_tiff_write_18() @@ -722,6 +750,10 @@ def test_tiff_write_18_disable_readdir(): # Test writing a TIFF with an _RPC.TXT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_rpc_txt(): # Translate RPC controlled data to GeoTIFF. @@ -774,6 +806,10 @@ def test_tiff_write_rpc_txt(): # Test writing a TIFF with an RPC in .aux.xml +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_rpc_in_pam(): ds_in = gdal.Open("data/rpc.vrt") @@ -1269,6 +1305,10 @@ def test_tiff_write_31(): # Create a rotated image +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_32(): ds_in = gdal.Open("data/byte.vrt") @@ -1309,6 +1349,10 @@ def test_tiff_write_32(): # (BASELINE is tested by tiff_write_15) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_33(): ds_in = gdal.Open("data/byte.vrt") @@ -1464,6 +1508,10 @@ def tiff_write_big_odd_bits(vrtfilename, tmpfilename, nbits, interleaving): # Test copy with NBITS=9, INTERLEAVE=PIXEL +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_36(): return tiff_write_big_odd_bits("data/uint16_3band.vrt", "tmp/tw_36.tif", 9, "PIXEL") @@ -1472,6 +1520,10 @@ def test_tiff_write_36(): # Test copy with NBITS=9, INTERLEAVE=BAND +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_37(): return tiff_write_big_odd_bits("data/uint16_3band.vrt", "tmp/tw_37.tif", 9, "BAND") @@ -1480,6 +1532,10 @@ def test_tiff_write_37(): # Test copy with NBITS=12, INTERLEAVE=PIXEL +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_38(): return tiff_write_big_odd_bits( "data/uint16_3band.vrt", "tmp/tw_38.tif", 12, "PIXEL" @@ -1490,6 +1546,10 @@ def test_tiff_write_38(): # Test copy with NBITS=12, INTERLEAVE=BAND +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_39(): return tiff_write_big_odd_bits("data/uint16_3band.vrt", "tmp/tw_39.tif", 12, "BAND") @@ -1498,6 +1558,10 @@ def test_tiff_write_39(): # Test copy with NBITS=17, INTERLEAVE=PIXEL +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_40(): return tiff_write_big_odd_bits("data/uint32_3band.vrt", "tmp/tw_40tif", 17, "PIXEL") @@ -1506,6 +1570,10 @@ def test_tiff_write_40(): # Test copy with NBITS=17, INTERLEAVE=BAND +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_41(): return tiff_write_big_odd_bits("data/uint32_3band.vrt", "tmp/tw_41.tif", 17, "BAND") @@ -1514,6 +1582,10 @@ def test_tiff_write_41(): # Test copy with NBITS=24, INTERLEAVE=PIXEL +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_42(): return tiff_write_big_odd_bits( "data/uint32_3band.vrt", "tmp/tw_42.tif", 24, "PIXEL" @@ -1524,6 +1596,10 @@ def test_tiff_write_42(): # Test copy with NBITS=24, INTERLEAVE=BAND +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_43(): return tiff_write_big_odd_bits("data/uint32_3band.vrt", "tmp/tw_43.tif", 24, "BAND") @@ -4892,6 +4968,10 @@ def test_tiff_write_120(): # Test error cases of COPY_SRC_OVERVIEWS creation option +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_121(): # Test when the overview band is NULL @@ -5326,6 +5406,10 @@ def test_tiff_write_125(): # Test implicit JPEG-in-TIFF overviews +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_creation_option("GTiff", "JPEG") @pytest.mark.require_driver("JPEG") def test_tiff_write_126(): @@ -6444,6 +6528,10 @@ def test_tiff_write_134(): # Test clearing GCPs (#5945) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_135(): # Simple clear @@ -7876,6 +7964,10 @@ def test_tiff_write_160(): # Test setting GCPs on an image with already a geotransform and vice-versa (#6751) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_161(): ds = gdaltest.tiff_drv.Create("/vsimem/tiff_write_161.tif", 1, 1) @@ -7910,6 +8002,10 @@ def test_tiff_write_161(): # Test creating a JPEG compressed file with big tiles (#6757) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_creation_option("GTiff", "JPEG") def test_tiff_write_162(): @@ -9252,6 +9348,10 @@ def test_tiff_write_compression_create_and_createcopy(): # Attempt at creating a file with more tile arrays larger than 2 GB +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_tiff_write_too_many_tiles(): src_ds = gdal.Open( diff --git a/autotest/gcore/transformer.py b/autotest/gcore/transformer.py index 2be372a75de9..3d291f33b2f7 100644 --- a/autotest/gcore/transformer.py +++ b/autotest/gcore/transformer.py @@ -70,6 +70,10 @@ def test_transformer_1(): # Test GCP based transformer with polynomials. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_2(): ds = gdal.Open("data/gcps.vrt") @@ -98,6 +102,10 @@ def test_transformer_2(): # Test GCP based transformer with thin plate splines. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_3(): ds = gdal.Open("data/gcps.vrt") @@ -126,6 +134,10 @@ def test_transformer_3(): # Test geolocation based transformer. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_4(): ds = gdal.Open("data/sstgeo.vrt") @@ -154,6 +166,10 @@ def test_transformer_4(): # Test RPC based transformer. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_5(): ds = gdal.Open("data/rpc.vrt") @@ -364,6 +380,10 @@ def test_transformer_5(): # Test RPC convergence bug (bug # 5395) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_6(): ds = gdal.Open("data/rpc_5395.vrt") @@ -402,6 +422,10 @@ def test_transformer_7(): # Test handling of nodata in RPC DEM (#5680) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_8(): ds = gdal.Open("data/rpc.vrt") @@ -448,6 +472,10 @@ def test_transformer_8(): # Test RPC DEM line optimization +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_9(): ds = gdal.Open("data/rpc.vrt") @@ -504,6 +532,10 @@ def test_transformer_9(): # Test RPC DEM transform from geoid height to ellipsoidal height +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("GTX") def test_transformer_10(): @@ -637,6 +669,10 @@ def test_transformer_11(): # Test degenerate cases of TPS transformer +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_12(): ds = gdal.Open( @@ -834,6 +870,10 @@ def test_transformer_14(): # beyond +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_15(): ds = gdal.GetDriverByName("MEM").Create("", 6600, 4400) @@ -933,6 +973,10 @@ def test_transformer_15(): # (we mostly test that the parameters are well recognized and serialized) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_16(): gdal.Translate( @@ -966,6 +1010,10 @@ def test_transformer_16(): # Test RPC DEM with unexisting RPC DEM file +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_17(): ds = gdal.Open("data/rpc.vrt") @@ -1018,6 +1066,10 @@ def test_transformer_no_reverse_method(): # Test precision of GCP based transformer with thin plate splines and lots of GCPs (2115). +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_tps_precision(): ds = gdal.Open("data/gcps_2115.vrt") @@ -1099,6 +1151,10 @@ def test_transformer_image_no_srs(): # Test RPC_DEM_SRS by adding vertical component egm 96 geoid +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_dem_overrride_srs(): ds = gdal.Open("data/rpc.vrt") ds_dem = gdal.GetDriverByName("GTiff").Create("/vsimem/dem.tif", 100, 100, 1) @@ -1191,6 +1247,10 @@ def test_transformer_SuggestedWarpOutput_from_options(): # Test GCP antimerdian unwrap (https://github.com/OSGeo/gdal/issues/8371) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_transformer_gcp_antimeridian_unwrap(): ds = gdal.Open("data/test_gcp_antimeridian_unwrap.vrt") diff --git a/autotest/gcore/vrt_read.py b/autotest/gcore/vrt_read.py index 2c4d319f4e33..6c7fc354bd15 100755 --- a/autotest/gcore/vrt_read.py +++ b/autotest/gcore/vrt_read.py @@ -42,6 +42,10 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) ############################################################################### @pytest.fixture(autouse=True, scope="module") diff --git a/autotest/gcore/vrtmisc.py b/autotest/gcore/vrtmisc.py index 472f0c9bdc56..2e4a3fac2869 100755 --- a/autotest/gcore/vrtmisc.py +++ b/autotest/gcore/vrtmisc.py @@ -36,10 +36,16 @@ import tempfile from pathlib import Path +import gdaltest import pytest from osgeo import gdal, osr +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Test linear scaling diff --git a/autotest/gcore/vsistdin.py b/autotest/gcore/vsistdin.py index 1e68741873f3..4dab16e36979 100755 --- a/autotest/gcore/vsistdin.py +++ b/autotest/gcore/vsistdin.py @@ -108,6 +108,10 @@ def test_vsistdin_3(): # Test fix for #6061 +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_vsistdin_4(): if test_cli_utilities.get_gdal_translate_path() is None: pytest.skip() diff --git a/autotest/gdrivers/aaigrid.py b/autotest/gdrivers/aaigrid.py index 8c1fb3f79854..aac8012327bf 100755 --- a/autotest/gdrivers/aaigrid.py +++ b/autotest/gdrivers/aaigrid.py @@ -236,6 +236,10 @@ def test_aaigrid_6bis(): # Verify writing files with non-square pixels. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_aaigrid_7(): tst = gdaltest.GDALTest("AAIGRID", "aaigrid/nonsquare.vrt", 1, 12481) diff --git a/autotest/gdrivers/derived.py b/autotest/gdrivers/derived.py index 00ef1e9ff98f..bb39e8d61632 100755 --- a/autotest/gdrivers/derived.py +++ b/autotest/gdrivers/derived.py @@ -28,6 +28,7 @@ # DEALINGS IN THE SOFTWARE. ############################################################################### +import gdaltest import pytest from osgeo import gdal @@ -159,6 +160,12 @@ def test_derived_test3(): # Raster with zero band gdal.Open("DERIVED_SUBDATASET:LOGAMPLITUDE:data/hdf5/CSK_DGM.h5") + +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) +def test_derived_vrt_errors(): for function in [ "real", "imag", diff --git a/autotest/gdrivers/dimap.py b/autotest/gdrivers/dimap.py index 9758e256362d..1b4b50954e09 100755 --- a/autotest/gdrivers/dimap.py +++ b/autotest/gdrivers/dimap.py @@ -31,6 +31,7 @@ import os import shutil +import gdaltest import pytest from osgeo import gdal @@ -41,6 +42,10 @@ # Open and verify a the GCPs and metadata. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_dimap_1(): shutil.copy("data/dimap/METADATA.DIM", "tmp") diff --git a/autotest/gdrivers/ecw.py b/autotest/gdrivers/ecw.py index d0407441e7fd..000e90c1f450 100755 --- a/autotest/gdrivers/ecw.py +++ b/autotest/gdrivers/ecw.py @@ -1038,6 +1038,10 @@ def test_ecw_31(): # It ignores the content of panBandMap. (#4234) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_ecw_32(): ds = gdal.Open("data/ecw/jrc.ecw") diff --git a/autotest/gdrivers/ehdr.py b/autotest/gdrivers/ehdr.py index 6fb4b75b747f..89876bd50c5c 100755 --- a/autotest/gdrivers/ehdr.py +++ b/autotest/gdrivers/ehdr.py @@ -153,6 +153,10 @@ def test_ehdr_7(): # Test signed 8bit integer support. (#2717) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_ehdr_8(): drv = gdal.GetDriverByName("EHDR") diff --git a/autotest/gdrivers/ers.py b/autotest/gdrivers/ers.py index 701580704ac9..a879e585c3f2 100755 --- a/autotest/gdrivers/ers.py +++ b/autotest/gdrivers/ers.py @@ -140,6 +140,10 @@ def test_ers_7(): # Test GCP support +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_ers_8(): src_ds = gdal.Open("../gcore/data/gcps.vrt") diff --git a/autotest/gdrivers/gpkg.py b/autotest/gdrivers/gpkg.py index 304d0e0b9262..5cc63adbe464 100755 --- a/autotest/gdrivers/gpkg.py +++ b/autotest/gdrivers/gpkg.py @@ -850,6 +850,10 @@ def test_gpkg_10(): # Single band with 32 bit color table +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.parametrize("tile_drv_name", ["JPEG", "WEBP"]) def test_gpkg_11(tile_drv_name): diff --git a/autotest/gdrivers/grib.py b/autotest/gdrivers/grib.py index 66efaa6aef83..1089332651a4 100755 --- a/autotest/gdrivers/grib.py +++ b/autotest/gdrivers/grib.py @@ -1732,7 +1732,8 @@ def test_grib_grib2_write_data_encodings_warnings_and_errors(): tests += [["data/byte.tif", ["JPEG2000_DRIVER=DERIVED"]]] # Read-only driver tests += [["../gcore/data/cfloat32.tif", []]] # complex data type tests += [["data/aaigrid/float64.asc", []]] # no projection - tests += [["data/test_nosrs.vrt", []]] # no geotransform + if gdaltest.vrt_has_open_support(): + tests += [["data/test_nosrs.vrt", []]] # no geotransform tests += [["data/envi/rotation.img", []]] # geotransform with rotation terms gdal.GetDriverByName("GTiff").Create( "/vsimem/huge.tif", 65535, 65535, 1, options=["SPARSE_OK=YES"] diff --git a/autotest/gdrivers/gta.py b/autotest/gdrivers/gta.py index 556dec404f59..89a2423c830c 100755 --- a/autotest/gdrivers/gta.py +++ b/autotest/gdrivers/gta.py @@ -98,6 +98,10 @@ def test_gta_2(): # Test writing and readings GCPs +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gta_3(): src_ds = gdal.Open("../gcore/data/gcps.vrt") diff --git a/autotest/gdrivers/gti.py b/autotest/gdrivers/gti.py index 2bab88273269..a29f282736de 100755 --- a/autotest/gdrivers/gti.py +++ b/autotest/gdrivers/gti.py @@ -820,9 +820,9 @@ def test_gti_invalid_srs(tmp_vsimem): gdal.Open(index_filename) -def test_gti_valid_srs(tmp_vsimem): +def test_gti_valid_srs(tmp_path): - index_filename = str(tmp_vsimem / "index.gti.gpkg") + index_filename = str(tmp_path / "index.gti.gpkg") src_ds = gdal.Open(os.path.join(os.getcwd(), "data", "byte.tif")) index_ds, lyr = create_basic_tileindex(index_filename, src_ds) @@ -1019,6 +1019,10 @@ def test_gti_no_metadata_rgb(tmp_vsimem): check_basic(vrt_ds, src_ds) +@pytest.mark.skipif( + gdal.GetDriverByName("VRT").GetMetadataItem(gdal.DMD_OPENOPTIONLIST) is None, + reason="VRT driver open missing", +) def test_gti_rgb_left_right(tmp_vsimem): index_filename = str(tmp_vsimem / "index.gti.gpkg") @@ -1078,6 +1082,10 @@ def test_gti_rgb_left_right(tmp_vsimem): assert flags == gdal.GDAL_DATA_COVERAGE_STATUS_DATA and pct == 100.0 +@pytest.mark.skipif( + gdal.GetDriverByName("VRT").GetMetadataItem(gdal.DMD_OPENOPTIONLIST) is None, + reason="VRT driver open missing", +) def test_gti_overlapping_sources(tmp_vsimem): filename1 = str(tmp_vsimem / "one.tif") @@ -1345,6 +1353,10 @@ def test_gti_overlapping_sources(tmp_vsimem): assert vrt_ds.GetRasterBand(1).Checksum() == 2, sort_values +@pytest.mark.skipif( + gdal.GetDriverByName("VRT").GetMetadataItem(gdal.DMD_OPENOPTIONLIST) is None, + reason="VRT driver open missing", +) def test_gti_gap_between_sources(tmp_vsimem): filename1 = str(tmp_vsimem / "one.tif") @@ -1380,6 +1392,10 @@ def test_gti_gap_between_sources(tmp_vsimem): ) +@pytest.mark.skipif( + gdal.GetDriverByName("VRT").GetMetadataItem(gdal.DMD_OPENOPTIONLIST) is None, + reason="VRT driver open missing", +) def test_gti_no_source(tmp_vsimem): index_filename = str(tmp_vsimem / "index.gti.gpkg") diff --git a/autotest/gdrivers/hfa.py b/autotest/gdrivers/hfa.py index e68e2236bbe8..bbdc7eb27324 100755 --- a/autotest/gdrivers/hfa.py +++ b/autotest/gdrivers/hfa.py @@ -666,6 +666,10 @@ def test_hfa_vsimem(): # the .img file. (#2422) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_hfa_proName(): drv = gdal.GetDriverByName("HFA") diff --git a/autotest/gdrivers/jp2openjpeg.py b/autotest/gdrivers/jp2openjpeg.py index cc64df8dabf1..16e14fdc5fb9 100755 --- a/autotest/gdrivers/jp2openjpeg.py +++ b/autotest/gdrivers/jp2openjpeg.py @@ -389,6 +389,10 @@ def test_jp2openjpeg_12(): # Check that PAM overrides internal GCPs (#5279) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_jp2openjpeg_13(): # Create a dataset with GCPs @@ -1446,6 +1450,10 @@ def test_jp2openjpeg_32(): # Test crazy tile size +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_jp2openjpeg_33(): src_ds = gdal.Open( @@ -3818,6 +3826,10 @@ def test_jp2openjpeg_mosaic(): @pytest.mark.require_curl() +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_jp2openjpeg_vrt_protocol(): (webserver_process, webserver_port) = webserver.launch( diff --git a/autotest/gdrivers/jpeg.py b/autotest/gdrivers/jpeg.py index 2dae55fe1e1d..fef684336e0f 100755 --- a/autotest/gdrivers/jpeg.py +++ b/autotest/gdrivers/jpeg.py @@ -800,6 +800,10 @@ def test_jpeg_mask_lsb_order_issue_4351(): # Test correct GCP reading with PAM (#5352) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_jpeg_20(): src_ds = gdal.Open("data/rgb_gcp.vrt") diff --git a/autotest/gdrivers/kmlsuperoverlay.py b/autotest/gdrivers/kmlsuperoverlay.py index 11cfb79e7fa1..8816100c0e6a 100755 --- a/autotest/gdrivers/kmlsuperoverlay.py +++ b/autotest/gdrivers/kmlsuperoverlay.py @@ -127,6 +127,10 @@ def test_kmlsuperoverlay_3(): # Test overviews +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_kmlsuperoverlay_4(): vrt_xml = """ @@ -231,6 +235,10 @@ def test_kmlsuperoverlay_4(): # Test that a raster which crosses the anti-meridian will be able to be displayed correctly (#4528) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_kmlsuperoverlay_5(): from xml.etree import ElementTree @@ -398,6 +406,10 @@ def test_kmlsuperoverlay_gx_latlonquad(): # KML/PNG files in transparent areas +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_kmlsuperoverlay_8(): # a large raster with actual data on each end and blank space in between diff --git a/autotest/gdrivers/mrf.py b/autotest/gdrivers/mrf.py index c46f39bff99f..f7a327d44156 100755 --- a/autotest/gdrivers/mrf.py +++ b/autotest/gdrivers/mrf.py @@ -203,6 +203,10 @@ def cleanup(base="/vsimem/out."): gdal.Unlink(base + ext) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_mrf_zen_test(): expectedCS = 770 diff --git a/autotest/gdrivers/netcdf.py b/autotest/gdrivers/netcdf.py index 56902f5367f1..83ab84e5f25c 100755 --- a/autotest/gdrivers/netcdf.py +++ b/autotest/gdrivers/netcdf.py @@ -1190,6 +1190,10 @@ def test_netcdf_28(tmp_path): # metadata to netcdf file with SetMetadata() and SetMetadataItem()). +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_netcdf_29(tmp_path): # create tif file using gdalwarp @@ -1451,6 +1455,10 @@ def test_netcdf_38(): # Test VRT and NETCDF: +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_netcdf_39(): shutil.copy("data/netcdf/two_vars_scale_offset.nc", "tmp") @@ -1482,6 +1490,10 @@ def test_netcdf_39(): assert cs == 65463 +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_netcdf_39_absolute(): if ( diff --git a/autotest/gdrivers/netcdf_multidim.py b/autotest/gdrivers/netcdf_multidim.py index 46c347a42d99..9714899a4df0 100755 --- a/autotest/gdrivers/netcdf_multidim.py +++ b/autotest/gdrivers/netcdf_multidim.py @@ -1528,6 +1528,10 @@ def copy(): gdal.Unlink(tmpfilename2) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_netcdf_multidim_dims_with_same_name_different_size(): src_ds = gdal.OpenEx( diff --git a/autotest/gdrivers/nitf.py b/autotest/gdrivers/nitf.py index 9ca57a6a3634..582b8622d094 100755 --- a/autotest/gdrivers/nitf.py +++ b/autotest/gdrivers/nitf.py @@ -1506,6 +1506,10 @@ def test_nitf_34(): # Test CreateCopy() writing file with a text segment. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_35(): src_ds = gdal.Open("data/nitf/text_md.vrt") @@ -1598,6 +1602,10 @@ def test_nitf_37(): # Create and read a NITF file with 999 images +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_38(): ds = gdal.Open("data/byte.tif") @@ -1978,6 +1986,10 @@ def test_nitf_check_jpeg2000_overviews(driver_to_test): # Check reading of rsets. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_47(): ds = gdal.Open("data/nitf/rset.ntf.r0") @@ -1997,6 +2009,10 @@ def test_nitf_47(): # Check building of standard overviews in place of rset overviews. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_48(): try: @@ -2038,6 +2054,10 @@ def test_nitf_48(): # Test TEXT and CGM creation options with CreateCopy() (#3376) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_49(): options = [ @@ -2759,6 +2779,10 @@ def test_nitf_68(): # Test SetGCPs() support +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_nitf_69(): vrt_txt = """ diff --git a/autotest/gdrivers/pdf.py b/autotest/gdrivers/pdf.py index 7db4786de764..c1c69f3c79d9 100755 --- a/autotest/gdrivers/pdf.py +++ b/autotest/gdrivers/pdf.py @@ -1007,11 +1007,19 @@ def _pdf_update_gcps(poppler_or_pdfium): gdaltest.pdf_drv.Delete(out_filename) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_update_gcps_iso32000(poppler_or_pdfium): gdal.SetConfigOption("GDAL_PDF_GEO_ENCODING", None) _pdf_update_gcps(poppler_or_pdfium) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_update_gcps_ogc_bp(poppler_or_pdfium): with gdal.config_option("GDAL_PDF_GEO_ENCODING", "OGC_BP"): _pdf_update_gcps(poppler_or_pdfium) @@ -1021,6 +1029,10 @@ def test_pdf_update_gcps_ogc_bp(poppler_or_pdfium): # Check SetGCPs() but with GCPs that do *not* resolve to a geotransform +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_set_5_gcps_ogc_bp(poppler_or_pdfium): dpi = 300 out_filename = "tmp/pdf_set_5_gcps_ogc_bp.pdf" @@ -1246,6 +1258,10 @@ def test_pdf_set_neatline_ogc_bp(poppler_or_pdfium): # Check that we can generate identical file +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_check_identity_iso32000(poppler_or_pdfium): out_filename = "tmp/pdf_check_identity_iso32000.pdf" @@ -1279,6 +1295,10 @@ def test_pdf_check_identity_iso32000(poppler_or_pdfium): # Check that we can generate identical file +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_check_identity_ogc_bp(poppler_or_pdfium): out_filename = "tmp/pdf_check_identity_ogc_bp.pdf" @@ -1453,6 +1473,10 @@ def test_pdf_custom_layout(poppler_or_pdfium): # Test CLIPPING_EXTENT, EXTRA_RASTERS, EXTRA_RASTERS_LAYER_NAME, OFF_LAYERS, EXCLUSIVE_LAYERS options +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_pdf_extra_rasters(poppler_or_pdfium): subbyte = """ PROJCS["NAD27 / UTM zone 11N",GEOGCS["NAD27",DATUM["North_American_Datum_1927",SPHEROID["Clarke 1866",6378206.4,294.9786982139006,AUTHORITY["EPSG","7008"]],AUTHORITY["EPSG","6267"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4267"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","26711"]] @@ -1719,6 +1743,10 @@ def test_pdf_jpeg_direct_copy(poppler_or_pdfium): # Test direct copy of source JPEG file within VRT file +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("JPEG") def test_pdf_jpeg_in_vrt_direct_copy(poppler_or_pdfium): diff --git a/autotest/gdrivers/prf.py b/autotest/gdrivers/prf.py index 33e253f69879..e052d9d8b844 100755 --- a/autotest/gdrivers/prf.py +++ b/autotest/gdrivers/prf.py @@ -85,6 +85,10 @@ def test_prf_3(): ds = None +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_prf_4(): tst = gdaltest.GDALTest("prf", "./PRF/dem.x-dem", 1, 0) diff --git a/autotest/gdrivers/sigdem.py b/autotest/gdrivers/sigdem.py index 1670399e2c6c..28c2fb0664b8 100755 --- a/autotest/gdrivers/sigdem.py +++ b/autotest/gdrivers/sigdem.py @@ -31,6 +31,7 @@ import gdaltest +import pytest ############################################################################### # Create simple copy and check. @@ -49,6 +50,10 @@ def test_sigdem_copy_check_prj(): # Verify writing files with non-square pixels. +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_sigdem_non_square(): tst = gdaltest.GDALTest("SIGDEM", "sigdem/nonsquare_nad27_utm11.vrt", 1, 12481) diff --git a/autotest/gdrivers/test_validate_jp2.py b/autotest/gdrivers/test_validate_jp2.py index ad3d7e7c22cc..734d26b7aa65 100755 --- a/autotest/gdrivers/test_validate_jp2.py +++ b/autotest/gdrivers/test_validate_jp2.py @@ -114,6 +114,10 @@ def validate(filename, inspire_tg=True, expected_gmljp2=True, oidoc=None): # Highly corrupted file +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_validate_jp2_2(): import build_jp2_from_xml @@ -284,6 +288,10 @@ def test_validate_jp2_4(): # Also a RGN marker +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_validate_jp2_5(): import build_jp2_from_xml diff --git a/autotest/gdrivers/vrtderived.py b/autotest/gdrivers/vrtderived.py index b5fd42965881..296dfbe0916a 100755 --- a/autotest/gdrivers/vrtderived.py +++ b/autotest/gdrivers/vrtderived.py @@ -37,6 +37,10 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) ############################################################################### @pytest.fixture(autouse=True, scope="module") diff --git a/autotest/gdrivers/vrtfilt.py b/autotest/gdrivers/vrtfilt.py index 579a4003509f..932ae18ffe9e 100755 --- a/autotest/gdrivers/vrtfilt.py +++ b/autotest/gdrivers/vrtfilt.py @@ -34,6 +34,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Verify simple 3x3 averaging filter. diff --git a/autotest/gdrivers/vrtlut.py b/autotest/gdrivers/vrtlut.py index 251e89ae21ff..94fb3fa87380 100755 --- a/autotest/gdrivers/vrtlut.py +++ b/autotest/gdrivers/vrtlut.py @@ -35,6 +35,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Simple test diff --git a/autotest/gdrivers/vrtmask.py b/autotest/gdrivers/vrtmask.py index 13b3822176d9..b24e7915e073 100755 --- a/autotest/gdrivers/vrtmask.py +++ b/autotest/gdrivers/vrtmask.py @@ -36,6 +36,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Test with a global dataset mask band diff --git a/autotest/gdrivers/vrtmultidim.py b/autotest/gdrivers/vrtmultidim.py index 1c701a6b0b54..e1dca6b93182 100755 --- a/autotest/gdrivers/vrtmultidim.py +++ b/autotest/gdrivers/vrtmultidim.py @@ -36,6 +36,10 @@ from osgeo import gdal, osr +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) ############################################################################### @pytest.fixture(autouse=True, scope="module") diff --git a/autotest/gdrivers/vrtovr.py b/autotest/gdrivers/vrtovr.py index da56dc867369..5e63a7397992 100755 --- a/autotest/gdrivers/vrtovr.py +++ b/autotest/gdrivers/vrtovr.py @@ -35,6 +35,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Simple test diff --git a/autotest/gdrivers/vrtpansharpen.py b/autotest/gdrivers/vrtpansharpen.py index e3ba9af028d4..fb650476a0ce 100755 --- a/autotest/gdrivers/vrtpansharpen.py +++ b/autotest/gdrivers/vrtpansharpen.py @@ -36,6 +36,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + @pytest.fixture(autouse=True, scope="module") def startup_and_cleanup(): diff --git a/autotest/gdrivers/vrtprocesseddataset.py b/autotest/gdrivers/vrtprocesseddataset.py index b11483b16df0..76de54f650ce 100755 --- a/autotest/gdrivers/vrtprocesseddataset.py +++ b/autotest/gdrivers/vrtprocesseddataset.py @@ -31,6 +31,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + np = pytest.importorskip("numpy") pytest.importorskip("osgeo.gdal_array") diff --git a/autotest/gdrivers/vrtrawlink.py b/autotest/gdrivers/vrtrawlink.py index 1f4203fc2874..d2ad48e27530 100755 --- a/autotest/gdrivers/vrtrawlink.py +++ b/autotest/gdrivers/vrtrawlink.py @@ -37,6 +37,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + def _xmlsearch(root, nodetype, name): for node in root[2:]: diff --git a/autotest/gdrivers/vrtwarp.py b/autotest/gdrivers/vrtwarp.py index 9b843aa81342..0b412d0e10d1 100755 --- a/autotest/gdrivers/vrtwarp.py +++ b/autotest/gdrivers/vrtwarp.py @@ -38,6 +38,11 @@ from osgeo import gdal +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + ############################################################################### # Verify reading from simple existing warp definition. diff --git a/autotest/gdrivers/wms.py b/autotest/gdrivers/wms.py index 9e7ca4da5508..02c3f8921d9e 100755 --- a/autotest/gdrivers/wms.py +++ b/autotest/gdrivers/wms.py @@ -568,6 +568,10 @@ def test_wms_12(): # Test reading WMS through VRT (test effect of r21866) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @gdaltest.disable_exceptions() def test_wms_13(): diff --git a/autotest/pymod/gdaltest.py b/autotest/pymod/gdaltest.py index 1c1677a3164b..5bedd015acd4 100755 --- a/autotest/pymod/gdaltest.py +++ b/autotest/pymod/gdaltest.py @@ -2199,3 +2199,8 @@ def tell(self): def vsi_open(path, mode="r"): return VSIFile(path, mode) + + +def vrt_has_open_support(): + drv = gdal.GetDriverByName("VRT") + return drv is not None and drv.GetMetadataItem(gdal.DMD_OPENOPTIONLIST) is not None diff --git a/autotest/pyscripts/gdal2tiles/test_logger.py b/autotest/pyscripts/gdal2tiles/test_logger.py index de9cd087b1bd..97b6ebe2711c 100644 --- a/autotest/pyscripts/gdal2tiles/test_logger.py +++ b/autotest/pyscripts/gdal2tiles/test_logger.py @@ -29,11 +29,17 @@ # DEALINGS IN THE SOFTWARE. ############################################################################### +import gdaltest import pytest from osgeo import gdal from osgeo_utils import gdal2tiles +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + def test_gdal2tiles_logger(): diff --git a/autotest/pyscripts/gdal2tiles/test_vsimem.py b/autotest/pyscripts/gdal2tiles/test_vsimem.py index 340e0238f7c4..deaff34fe74a 100644 --- a/autotest/pyscripts/gdal2tiles/test_vsimem.py +++ b/autotest/pyscripts/gdal2tiles/test_vsimem.py @@ -29,11 +29,17 @@ # DEALINGS IN THE SOFTWARE. ############################################################################### +import gdaltest import pytest from osgeo import gdal from osgeo_utils import gdal2tiles +pytestmark = pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) + def test_gdal2tiles_vsimem(): diff --git a/autotest/pyscripts/test_gdal2tiles.py b/autotest/pyscripts/test_gdal2tiles.py index b3da97a4de72..a8c2159df649 100755 --- a/autotest/pyscripts/test_gdal2tiles.py +++ b/autotest/pyscripts/test_gdal2tiles.py @@ -43,10 +43,15 @@ from osgeo import gdal, osr # noqa from osgeo_utils.gdalcompare import compare_db -pytestmark = pytest.mark.skipif( - test_py_scripts.get_py_script("gdal2tiles") is None, - reason="gdal2tiles not available", -) +pytestmark = [ + pytest.mark.skipif( + test_py_scripts.get_py_script("gdal2tiles") is None, + reason="gdal2tiles not available", + ), + pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), reason="VRT driver open missing" + ), +] @pytest.fixture() diff --git a/autotest/pyscripts/test_gdal_pansharpen.py b/autotest/pyscripts/test_gdal_pansharpen.py index 160b68879b94..9883e9a14ad8 100755 --- a/autotest/pyscripts/test_gdal_pansharpen.py +++ b/autotest/pyscripts/test_gdal_pansharpen.py @@ -29,7 +29,7 @@ # DEALINGS IN THE SOFTWARE. ############################################################################### - +import gdaltest import pytest import test_py_scripts @@ -95,6 +95,10 @@ def test_gdal_pansharpen_version(script_path): # Simple test +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_pansharpen_1(script_path, tmp_path, small_world_pan_tif): out_tif = str(tmp_path / "out.tif") @@ -120,6 +124,10 @@ def test_gdal_pansharpen_1(script_path, tmp_path, small_world_pan_tif): # Full options +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_pansharpen_2(script_path, tmp_path, small_world_pan_tif): out_vrt = str(tmp_path / "out.vrt") diff --git a/autotest/pyscripts/test_gdalattachpct.py b/autotest/pyscripts/test_gdalattachpct.py index d81b173eadc4..bc27b4d39bda 100755 --- a/autotest/pyscripts/test_gdalattachpct.py +++ b/autotest/pyscripts/test_gdalattachpct.py @@ -28,6 +28,7 @@ # DEALINGS IN THE SOFTWARE. ############################################################################### +import gdaltest import pytest import test_py_scripts @@ -91,6 +92,10 @@ def test_gdalattachpct_basic(script_path, tmp_path, palette_file): # Test outputting to VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalattachpct_vrt_output(script_path, tmp_path, palette_file): src_filename = str(tmp_path / "src.tif") diff --git a/autotest/pyscripts/test_gdalbuildvrtofvrt.py b/autotest/pyscripts/test_gdalbuildvrtofvrt.py index 19630a21727a..19b8b51fd27c 100755 --- a/autotest/pyscripts/test_gdalbuildvrtofvrt.py +++ b/autotest/pyscripts/test_gdalbuildvrtofvrt.py @@ -30,6 +30,7 @@ import os +import gdaltest import pytest import test_py_scripts @@ -41,6 +42,9 @@ test_py_scripts.get_py_script("gdalbuildvrtofvrt") is None, reason="gdalbuildvrtofvrt.py not available", ), + pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), reason="VRT driver open missing" + ), ] diff --git a/autotest/pyscripts/test_gdalinfo_py.py b/autotest/pyscripts/test_gdalinfo_py.py index 235b40dbdc29..43bf7fe4e28e 100755 --- a/autotest/pyscripts/test_gdalinfo_py.py +++ b/autotest/pyscripts/test_gdalinfo_py.py @@ -31,6 +31,7 @@ import os import shutil +import gdaltest import pytest import test_py_scripts @@ -154,6 +155,10 @@ def test_gdalinfo_py_6(script_path): # Test a dataset with GCPs +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalinfo_py_7(script_path): ret = test_py_scripts.run_py_script( diff --git a/autotest/utilities/test_gdal_create.py b/autotest/utilities/test_gdal_create.py index 13c26b7fb58d..936ca76f9162 100755 --- a/autotest/utilities/test_gdal_create.py +++ b/autotest/utilities/test_gdal_create.py @@ -222,6 +222,10 @@ def test_gdal_create_input_file_overrrides(gdal_create_path, tmp_path): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_create_input_file_gcps(gdal_create_path, tmp_path): output_tif = str(tmp_path / "tmp.tif") diff --git a/autotest/utilities/test_gdal_translate.py b/autotest/utilities/test_gdal_translate.py index 446839a4055f..dad3024e4520 100755 --- a/autotest/utilities/test_gdal_translate.py +++ b/autotest/utilities/test_gdal_translate.py @@ -420,6 +420,10 @@ def test_gdal_translate_15(gdal_translate_path, tmp_path): # Test -of VRT which is a special case +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_16(gdal_translate_path, tmp_path): dst_vrt = str(tmp_path / "test16.vrt") @@ -440,6 +444,10 @@ def test_gdal_translate_16(gdal_translate_path, tmp_path): # Test -expand option to VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("GIF") def test_gdal_translate_17(gdal_translate_path, tmp_path): @@ -483,6 +491,10 @@ def test_gdal_translate_17(gdal_translate_path, tmp_path): # Test translation of a VRT made of VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("BMP") def test_gdal_translate_18(gdal_translate_path, tmp_path): @@ -781,6 +793,10 @@ def test_gdal_translate_28(gdal_translate_path, tmp_path): # Test -r +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_29(gdal_translate_path, tmp_path): dst_tif = str(tmp_path / "test_gdal_translate_29.tif") @@ -962,6 +978,10 @@ def test_gdal_translate_33ter(gdal_translate_path, tmp_path): # Test NBITS is preserved +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_34(gdal_translate_path, tmp_path): dst_vrt = str(tmp_path / "test_gdal_translate_34.vrt") diff --git a/autotest/utilities/test_gdal_translate_lib.py b/autotest/utilities/test_gdal_translate_lib.py index 26aa3c21a438..edd421ff449d 100755 --- a/autotest/utilities/test_gdal_translate_lib.py +++ b/autotest/utilities/test_gdal_translate_lib.py @@ -597,6 +597,10 @@ def test_gdal_translate_lib_104(): # Test GCPs propagation in "VRT path" +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_lib_gcp_vrt_path(): src_ds = gdal.Open("../gcore/data/gcps.vrt") @@ -613,6 +617,10 @@ def test_gdal_translate_lib_gcp_vrt_path(): # Test RPC propagation in "VRT path" +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_lib_rcp_vrt_path(): src_ds = gdal.Open("../gcore/data/rpc.vrt") @@ -624,6 +632,10 @@ def test_gdal_translate_lib_rcp_vrt_path(): # Test GeoLocation propagation in "VRT path" +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdal_translate_lib_geolocation_vrt_path(tmp_vsimem): src_ds = gdal.Open("../gcore/data/sstgeo.vrt") diff --git a/autotest/utilities/test_gdaladdo.py b/autotest/utilities/test_gdaladdo.py index 29f23085d3a8..e68d90072d6f 100755 --- a/autotest/utilities/test_gdaladdo.py +++ b/autotest/utilities/test_gdaladdo.py @@ -54,6 +54,10 @@ def gdaladdo_path(): # Similar to tiff_ovr_1 +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdaladdo_1(gdaladdo_path, tmp_path): shutil.copy("../gcore/data/mfloat32.vrt", f"{tmp_path}/mfloat32.vrt") @@ -230,6 +234,10 @@ def test_gdaladdo_partial_refresh_from_projwin(gdaladdo_path, tmp_path): # Test --partial-refresh-from-source-timestamp +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdaladdo_partial_refresh_from_source_timestamp(gdaladdo_path, tmp_path): left_tif = str(tmp_path / "left.tif") @@ -284,6 +292,10 @@ def test_gdaladdo_partial_refresh_from_source_timestamp(gdaladdo_path, tmp_path) # Test --partial-refresh-from-source-extent +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdaladdo_partial_refresh_from_source_extent(gdaladdo_path, tmp_path): left_tif = str(tmp_path / "left.tif") @@ -330,6 +342,10 @@ def test_gdaladdo_partial_refresh_from_source_extent(gdaladdo_path, tmp_path): # Test reuse of previous resampling method and overview levels +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.parametrize("read_only", [True, False]) def test_gdaladdo_reuse_previous_resampling_and_levels( gdaladdo_path, tmp_path, read_only @@ -382,8 +398,13 @@ def test_gdaladdo_reuse_previous_resampling_and_levels( @pytest.mark.require_driver("GPKG") +@pytest.mark.require_driver("GTI") def test_gdaladdo_partial_refresh_from_source_timestamp_gti(gdaladdo_path, tmp_path): + gti_drv = gdal.GetDriverByName("GTI") + if gti_drv.GetMetadataItem("IS_PLUGIN"): + pytest.skip("Test skipped because GTI driver as a plugin") + left_tif = str(tmp_path / "left.tif") right_tif = str(tmp_path / "right.tif") diff --git a/autotest/utilities/test_gdalbuildvrt.py b/autotest/utilities/test_gdalbuildvrt.py index 27b7756ee074..2088c4626c6a 100755 --- a/autotest/utilities/test_gdalbuildvrt.py +++ b/autotest/utilities/test_gdalbuildvrt.py @@ -35,10 +35,16 @@ from osgeo import gdal, osr -pytestmark = pytest.mark.skipif( - test_cli_utilities.get_gdalbuildvrt_path() is None, - reason="gdalbuildvrt not available", -) +pytestmark = [ + pytest.mark.skipif( + test_cli_utilities.get_gdalbuildvrt_path() is None, + reason="gdalbuildvrt not available", + ), + pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", + ), +] @pytest.fixture(scope="module") diff --git a/autotest/utilities/test_gdalbuildvrt_lib.py b/autotest/utilities/test_gdalbuildvrt_lib.py index 74e41222ed6e..2e1c0e98911d 100755 --- a/autotest/utilities/test_gdalbuildvrt_lib.py +++ b/autotest/utilities/test_gdalbuildvrt_lib.py @@ -97,6 +97,10 @@ def test_gdalbuildvrt_lib_2(): # Test creating overviews +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalbuildvrt_lib_ovr(tmp_vsimem): tmpfilename = tmp_vsimem / "my.vrt" @@ -668,6 +672,12 @@ def test_gdalbuildvrt_lib_strict_mode(): ############################################################################### + + +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalbuildvrt_lib_te_touching_on_edge(tmp_vsimem): tmp_filename = tmp_vsimem / "test_gdalbuildvrt_lib_te_touching_on_edge.vrt" @@ -794,6 +804,10 @@ def test_gdalbuildvrt_lib_nodataMaxMaskThreshold_rgba(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalbuildvrt_lib_nodataMaxMaskThreshold_rgb_mask(tmp_vsimem): # UInt16, VRTNodata=0 diff --git a/autotest/utilities/test_gdaldem.py b/autotest/utilities/test_gdaldem.py index 8372008cd1b4..b42c17bff5c1 100755 --- a/autotest/utilities/test_gdaldem.py +++ b/autotest/utilities/test_gdaldem.py @@ -381,6 +381,10 @@ def test_gdaldem_color_relief_cpt(gdaldem_path, tmp_path): # Test gdaldem color relief to VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdaldem_color_relief_vrt(gdaldem_path, n43_colorrelief_tif, tmp_path): output_vrt = str(tmp_path / "n43_colorrelief.vrt") @@ -518,6 +522,10 @@ def test_gdaldem_color_relief_nearest_color_entry(gdaldem_path, tmp_path): # Test gdaldem color relief with -nearest_color_entry and -of VRT +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdaldem_color_relief_nearest_color_entry_vrt(gdaldem_path, tmp_path): output_vrt = str(tmp_path / "n43_colorrelief_nearest.vrt") @@ -584,6 +592,10 @@ def test_gdaldem_color_relief_nodata_nan(gdaldem_path, tmp_path): # Test gdaldem color relief with entries with repeated DEM values in the color table (#6422) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("AAIGRID") def test_gdaldem_color_relief_repeated_entry(gdaldem_path, tmp_path): diff --git a/autotest/utilities/test_gdaldem_lib.py b/autotest/utilities/test_gdaldem_lib.py index af3170465c1e..76a724691d3b 100755 --- a/autotest/utilities/test_gdaldem_lib.py +++ b/autotest/utilities/test_gdaldem_lib.py @@ -526,6 +526,10 @@ def test_gdaldem_lib_color_relief_nodata_value(tmp_vsimem): gdal.Unlink(colorFilename) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.parametrize( "colorSelection", ["nearest_color_entry", "exact_color_entry", "linear_interpolation"], @@ -563,6 +567,10 @@ def test_gdaldem_lib_color_relief_synthetic(tmp_path, colorSelection, format): assert struct.unpack("B" * 4, ds.GetRasterBand(3).ReadRaster()) == (0, 12, 22, 32) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.parametrize( "colorSelection", ["nearest_color_entry", "exact_color_entry", "linear_interpolation"], diff --git a/autotest/utilities/test_gdalinfo.py b/autotest/utilities/test_gdalinfo.py index c3857c716b0f..815be240a395 100755 --- a/autotest/utilities/test_gdalinfo.py +++ b/autotest/utilities/test_gdalinfo.py @@ -135,6 +135,10 @@ def test_gdalinfo_6(gdalinfo_path): # Test a dataset with GCPs +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalinfo_7(gdalinfo_path): ret = gdaltest.runexternal( @@ -549,6 +553,10 @@ def test_gdalinfo_33(gdalinfo_path): # Test a dataset with GCPs +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalinfo_34(gdalinfo_path): ret = gdaltest.runexternal(gdalinfo_path + " -json ../gcore/data/gcps.vrt") diff --git a/autotest/utilities/test_gdallocationinfo.py b/autotest/utilities/test_gdallocationinfo.py index 575fa42c1c85..e17526f0147f 100755 --- a/autotest/utilities/test_gdallocationinfo.py +++ b/autotest/utilities/test_gdallocationinfo.py @@ -122,6 +122,10 @@ def test_gdallocationinfo_4(gdallocationinfo_path): # Test -lifonly +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdallocationinfo_5(gdallocationinfo_path): ret = gdaltest.runexternal( diff --git a/autotest/utilities/test_gdalmdiminfo.py b/autotest/utilities/test_gdalmdiminfo.py index 9977457513c5..11fa550adb68 100755 --- a/autotest/utilities/test_gdalmdiminfo.py +++ b/autotest/utilities/test_gdalmdiminfo.py @@ -48,6 +48,10 @@ def gdalmdiminfo_path(): # Simple test +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdiminfo_1(gdalmdiminfo_path): (ret, err) = gdaltest.runexternal_out_and_err(gdalmdiminfo_path + " data/mdim.vrt") @@ -59,6 +63,10 @@ def test_gdalmdiminfo_1(gdalmdiminfo_path): # Test -if option +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdiminfo_if_option(gdalmdiminfo_path): (ret, err) = gdaltest.runexternal_out_and_err( diff --git a/autotest/utilities/test_gdalmdimtranslate.py b/autotest/utilities/test_gdalmdimtranslate.py index a6cf1cec7529..7b34e3282149 100755 --- a/autotest/utilities/test_gdalmdimtranslate.py +++ b/autotest/utilities/test_gdalmdimtranslate.py @@ -50,6 +50,10 @@ def gdalmdimtranslate_path(): # Simple test +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_1(gdalmdimtranslate_path, tmp_path): dst_vrt = str(tmp_path / "out.vrt") @@ -65,6 +69,10 @@ def test_gdalmdimtranslate_1(gdalmdimtranslate_path, tmp_path): # Test -if option +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_if(gdalmdimtranslate_path, tmp_path): dst_vrt = str(tmp_path / "out.vrt") diff --git a/autotest/utilities/test_gdalmdimtranslate_lib.py b/autotest/utilities/test_gdalmdimtranslate_lib.py index 333f3a74e8d7..7f17d06d9fae 100755 --- a/autotest/utilities/test_gdalmdimtranslate_lib.py +++ b/autotest/utilities/test_gdalmdimtranslate_lib.py @@ -42,6 +42,10 @@ ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_no_arg(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -53,6 +57,10 @@ def test_gdalmdimtranslate_no_arg(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_multidim_to_mem(): out_ds = gdal.MultiDimTranslate("", "data/mdim.vrt", format="MEM") @@ -67,6 +75,10 @@ def test_gdalmdimtranslate_multidim_to_mem(): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_multidim_to_classic(tmp_vsimem): tmpfile = tmp_vsimem / "out.tif" @@ -84,6 +96,10 @@ def test_gdalmdimtranslate_multidim_to_classic(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_multidim_1d_to_classic(tmp_vsimem): tmpfile = tmp_vsimem / "out.tif" @@ -112,6 +128,10 @@ def test_gdalmdimtranslate_classic_to_classic(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_classic_to_multidim(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -171,6 +191,10 @@ def test_gdalmdimtranslate_classic_to_multidim(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_array(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -252,6 +276,10 @@ def test_gdalmdimtranslate_array(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_array_with_transpose_and_view(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -327,6 +355,10 @@ def test_gdalmdimtranslate_array_with_transpose_and_view(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_group(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -392,6 +424,10 @@ def test_gdalmdimtranslate_group(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_two_groups(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -462,6 +498,10 @@ def test_gdalmdimtranslate_two_groups(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_subset(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -717,6 +757,10 @@ def test_gdalmdimtranslate_subset(tmp_vsimem): ############################################################################### +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_scaleaxes(tmp_vsimem): tmpfile = tmp_vsimem / "out.vrt" @@ -791,6 +835,10 @@ def test_gdalmdimtranslate_scaleaxes(tmp_vsimem): ) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalmdimtranslate_dims_with_same_name_different_size(tmp_vsimem): srcfile = tmp_vsimem / "in.vrt" diff --git a/autotest/utilities/test_gdalwarp.py b/autotest/utilities/test_gdalwarp.py index ee749fed657d..0df412e936ba 100755 --- a/autotest/utilities/test_gdalwarp.py +++ b/autotest/utilities/test_gdalwarp.py @@ -383,6 +383,10 @@ def test_gdalwarp_14(gdalwarp_path, testgdalwarp_gcp_tif, tmp_path): # Test -of VRT which is a special case +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalwarp_16(gdalwarp_path, testgdalwarp_gcp_tif, tmp_path): dst_vrt = str(tmp_path / "testgdalwarp16.vrt") @@ -463,6 +467,10 @@ def test_gdalwarp_19(gdalwarp_path, testgdalwarp_gcp_tif, tmp_path): # Test -of VRT -et 0 which is a special case +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalwarp_20(gdalwarp_path, testgdalwarp_gcp_tif, tmp_path): dst_vrt = str(tmp_path / "testgdalwarp20.vrt") @@ -1047,6 +1055,10 @@ def test_gdalwarp_39(gdalwarp_path, tmp_path): # Test -ovr +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalwarp_40(gdalwarp_path, tmp_path): src_tif = str(tmp_path / "test_gdalwarp_40_src.tif") diff --git a/autotest/utilities/test_gdalwarp_lib.py b/autotest/utilities/test_gdalwarp_lib.py index 2d55e07c212a..6f0a63ca03af 100755 --- a/autotest/utilities/test_gdalwarp_lib.py +++ b/autotest/utilities/test_gdalwarp_lib.py @@ -1599,6 +1599,10 @@ def test_gdalwarp_lib_128(tmp_vsimem): # to an invalid geometry (#6375) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_geos def test_gdalwarp_lib_129(tmp_vsimem): @@ -2069,6 +2073,10 @@ def test_gdalwarp_lib_135h(gdalwarp_135_grid_gtx, gdalwarp_135_grid2_gtx): assert data == pytest.approx(115 / (1200.0 / 3937)), "Bad value" +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) @pytest.mark.require_driver("GTX") def test_gdalwarp_lib_135i( gdalwarp_135_src_ds, gdalwarp_135_grid_gtx, gdalwarp_135_grid2_gtx, tmp_path @@ -3324,6 +3332,10 @@ def test_gdalwarp_lib_src_nodata_with_dstalpha(): # Test warping from a dataset with points outside of Earth (fixes #4934) +@pytest.mark.skipif( + not gdaltest.vrt_has_open_support(), + reason="VRT driver open missing", +) def test_gdalwarp_lib_src_points_outside_of_earth(): class MyHandler: def __init__(self): diff --git a/frmts/CMakeLists.txt b/frmts/CMakeLists.txt index 875eaade5385..d89266d00376 100644 --- a/frmts/CMakeLists.txt +++ b/frmts/CMakeLists.txt @@ -39,10 +39,27 @@ gdal_optional_format(raw "Raw formats:EOSAT FAST Format, FARSITE LCP and Vexcel gdal_format(gtiff "GeoTIFF image format") set_package_properties(TIFF PROPERTIES PURPOSE "gdal_GTIFF: GeoTIFF image format") gdal_format(mem "Read/write data in Memory") -gdal_format(vrt "Virtual GDAL Datasets") + +# Exception to the rule: enable the VRT driver by default, even if +# GDAL_BUILD_OPTIONAL_DRIVERS=OFF. +if (NOT DEFINED GDAL_ENABLE_DRIVER_VRT AND + DEFINED GDAL_BUILD_OPTIONAL_DRIVERS AND + NOT GDAL_BUILD_OPTIONAL_DRIVERS) + message(WARNING "Enabling GDAL_ENABLE_DRIVER_VRT=ON, despite GDAL_BUILD_OPTIONAL_DRIVERS=OFF. You can of course override this choice by setting GDAL_ENABLE_DRIVER_VRT=OFF") + option(GDAL_ENABLE_DRIVER_VRT "Set ON to build Virtual GDAL Datasets" ON) +endif() + +gdal_optional_format(vrt "Virtual GDAL Datasets") +if (NOT GDAL_ENABLE_DRIVER_VRT) + # Even if we don't enable the driver (Open method), we still need to compile + # Most of it + add_subdirectory(vrt) +endif() # Note: derived is derived of vrt add_subdirectory(derived) +gdal_optional_format(gti "GDAL Tile Index") + # default formats if (CMAKE_BUILD_TYPE MATCHES "Debug" OR GDAL_ENABLE_DRIVER_NULL) diff --git a/frmts/gdalallregister.cpp b/frmts/gdalallregister.cpp index 376a5fc21199..ee30b082036b 100644 --- a/frmts/gdalallregister.cpp +++ b/frmts/gdalallregister.cpp @@ -329,10 +329,13 @@ void CPL_STDCALL GDALAllRegister() #ifdef FRMT_vrt GDALRegister_VRT(); - GDALRegister_GTI(); GDALRegister_Derived(); #endif +#ifdef FRMT_gti + GDALRegister_GTI(); +#endif + #ifdef FRMT_gtiff GDALRegister_GTiff(); GDALRegister_COG(); diff --git a/frmts/gti/CMakeLists.txt b/frmts/gti/CMakeLists.txt new file mode 100644 index 000000000000..91bc928ea953 --- /dev/null +++ b/frmts/gti/CMakeLists.txt @@ -0,0 +1,26 @@ +add_gdal_driver( + TARGET gdal_GTI + PLUGIN_CAPABLE + NO_DEPS + SOURCES gdaltileindexdataset.cpp + STRONG_CXX_WFLAGS) +gdal_standard_includes(gdal_GTI) +target_include_directories(gdal_GTI PRIVATE ${GDAL_RASTER_FORMAT_SOURCE_DIR}/vrt + $) + +set(GDAL_DATA_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/data/gdaltileindex.xsd +) +set_property( + TARGET ${GDAL_LIB_TARGET_NAME} + APPEND + PROPERTY RESOURCE "${GDAL_DATA_FILES}") + +if (GDAL_USE_GEOS) + gdal_target_link_libraries(gdal_GTI PRIVATE ${GEOS_TARGET}) + target_compile_definitions(gdal_GTI PRIVATE -DHAVE_GEOS=1) +endif () + +if (GDAL_ENABLE_DRIVER_GTI_PLUGIN) + target_compile_definitions(gdal_GTI PRIVATE -DBUILT_AS_PLUGIN) +endif() diff --git a/frmts/vrt/data/gdaltileindex.xsd b/frmts/gti/data/gdaltileindex.xsd similarity index 100% rename from frmts/vrt/data/gdaltileindex.xsd rename to frmts/gti/data/gdaltileindex.xsd diff --git a/frmts/vrt/gdaltileindexdataset.cpp b/frmts/gti/gdaltileindexdataset.cpp similarity index 99% rename from frmts/vrt/gdaltileindexdataset.cpp rename to frmts/gti/gdaltileindexdataset.cpp index 388f45136164..d7d8548d3a07 100644 --- a/frmts/vrt/gdaltileindexdataset.cpp +++ b/frmts/gti/gdaltileindexdataset.cpp @@ -4626,7 +4626,7 @@ void GDALRegister_GTI() if (GDALGetDriverByName("GTI") != nullptr) return; - auto poDriver = std::make_unique(); + auto poDriver = std::make_unique(); poDriver->SetDescription("GTI"); poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES"); @@ -4659,7 +4659,10 @@ void GDALRegister_GTI() "default='ALL_CPUS'/>" ""); +#ifdef BUILT_AS_PLUGIN + // Used by gdaladdo and test_gdaladdo.py + poDriver->SetMetadataItem("IS_PLUGIN", "YES"); +#endif + GetGDALDriverManager()->RegisterDriver(poDriver.release()); } - -/*! @endcond */ diff --git a/frmts/vrt/CMakeLists.txt b/frmts/vrt/CMakeLists.txt index 777c49af525a..8e423afd6d3a 100644 --- a/frmts/vrt/CMakeLists.txt +++ b/frmts/vrt/CMakeLists.txt @@ -17,7 +17,6 @@ add_gdal_driver( vrtprocesseddataset.cpp vrtprocesseddatasetfunctions.cpp vrtmultidim.cpp - gdaltileindexdataset.cpp STRONG_CXX_WFLAGS) gdal_standard_includes(gdal_vrt) target_include_directories(gdal_vrt PRIVATE ${GDAL_RASTER_FORMAT_SOURCE_DIR}/raw @@ -25,7 +24,6 @@ target_include_directories(gdal_vrt PRIVATE ${GDAL_RASTER_FORMAT_SOURCE_DIR}/raw set(GDAL_DATA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/gdalvrt.xsd - ${CMAKE_CURRENT_SOURCE_DIR}/data/gdaltileindex.xsd ) set_property( TARGET ${GDAL_LIB_TARGET_NAME} @@ -42,3 +40,7 @@ target_public_header(TARGET gdal HEADERS vrtdataset.h gdal_vrt.h) # because of use of GDALOpenVerticalShiftGrid set_property(SOURCE vrtwarped.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON) + +if (NOT GDAL_ENABLE_DRIVER_VRT) + target_compile_definitions(gdal_vrt PRIVATE -DNO_OPEN) +endif() diff --git a/frmts/vrt/vrt_priv.h b/frmts/vrt/vrt_priv.h index ca2af63383fb..ba53e815ad5d 100644 --- a/frmts/vrt/vrt_priv.h +++ b/frmts/vrt/vrt_priv.h @@ -52,10 +52,10 @@ GDALTileIndexDataset CPL_DLL *GDALDatasetCastToGTIDataset(GDALDataset *poDS); std::vector CPL_DLL GTIGetSourcesMoreRecentThan(GDALTileIndexDataset *poDS, int64_t mTime); -CPLStringList VRTParseCategoryNames(const CPLXMLNode *psCategoryNames); +CPLStringList CPL_DLL VRTParseCategoryNames(const CPLXMLNode *psCategoryNames); std::unique_ptr -VRTParseColorTable(const CPLXMLNode *psColorTable); + CPL_DLL VRTParseColorTable(const CPLXMLNode *psColorTable); #endif diff --git a/frmts/vrt/vrtdataset.h b/frmts/vrt/vrtdataset.h index 6368175e9a3f..f420dae3046a 100644 --- a/frmts/vrt/vrtdataset.h +++ b/frmts/vrt/vrtdataset.h @@ -51,8 +51,8 @@ CPLErr GDALRegisterDefaultPixelFunc(); void GDALVRTRegisterDefaultProcessedDatasetFuncs(); -CPLString VRTSerializeNoData(double dfVal, GDALDataType eDataType, - int nPrecision); +CPLString CPL_DLL VRTSerializeNoData(double dfVal, GDALDataType eDataType, + int nPrecision); #if 0 int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc, diff --git a/frmts/vrt/vrtdriver.cpp b/frmts/vrt/vrtdriver.cpp index 1152f22c25db..7f4b60e86c63 100644 --- a/frmts/vrt/vrtdriver.cpp +++ b/frmts/vrt/vrtdriver.cpp @@ -542,10 +542,12 @@ void GDALRegister_VRT() "