Skip to content

Commit

Permalink
Merge pull request OSGeo#5528 from rouault/remove_perl_bindings
Browse files Browse the repository at this point in the history
Remove deprecated SWIG Perl bindings (refs OSGeo#3555)
  • Loading branch information
rouault authored Mar 29, 2022
2 parents 64136e7 + 6a0c093 commit fa4d403
Show file tree
Hide file tree
Showing 89 changed files with 50 additions and 19,058 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ubuntu_20.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ jobs:
- name: Run C++ tests
run: docker run -e GITHUB_WORKFLOW --rm gdal sh -c "cd /build/autotest/cpp && make quick_test && make testsse2 && (if (g++ -march=native -dM -E -x c++ - < /dev/null | grep AVX2 >/dev/null); then make testavx2; else /bin/true; fi)"

- name: Run SWIG Perl tests
run: docker run --rm gdal sh -c "cd /build/swig/perl && make test"

- name: Run SWIG Java tests
run: docker run --rm gdal sh -c "cd /build/swig/java && make test"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_20.04/build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-rec
libopenexr-dev libheif-dev \
libdeflate-dev libblosc-dev liblz4-dev \
mono-mcs libmono-system-drawing4.0-cil ccache \
perl ant \
ant \
libbrotli-dev \
opencl-c-headers ocl-icd-opencl-dev

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ubuntu_20.04/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ ldconfig
mv java.opt.bak java.opt
)

# Perl bindings
(cd swig/perl && make generate && make)

ccache -s

#wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mdb-sqlite/mdb-sqlite-1.0.2.tar.bz2
Expand Down
16 changes: 0 additions & 16 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4950,22 +4950,6 @@ fi
export GDAL_PREFIX
AC_DEFINE_UNQUOTED(GDAL_PREFIX,["]$GDAL_PREFIX["], [--prefix directory for GDAL install])

dnl ---------------------------------------------------------------------------
dnl Perl bindings.
dnl ---------------------------------------------------------------------------

BINDINGS=

AC_ARG_WITH(perl,[ --with-perl Enable perl bindings],,)

AC_MSG_CHECKING([for perl bindings])
if test "$with_perl" = "yes" ; then
BINDINGS="perl $BINDINGS"
AC_MSG_RESULT([enabled])
else
AC_MSG_RESULT([disabled])
fi

dnl ---------------------------------------------------------------------------
dnl NG Python bindings.
dnl ---------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions doc/source/api/csharp/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Generally speaking the classes and methods mostly match those of the GDAL and OG

The C# bindings are also usable from other .NET languages, such as VB.Net.

The C# interface has been built upon the same libraries as the other SWIG generated wrappers (like Perl, Python, Java, PHP and Ruby). Therefore, the class names,
The C# interface has been built upon the same libraries as the other SWIG generated wrappers (like Python, Java). Therefore, the class names,
class member names, and the method signatures are driven by the GDAL+SWIG conventions and might not follow the conventional .NET naming guidelines.
However, one can easily identify the matching members in the GDAL/OGR API documentation.

Expand All @@ -22,7 +22,7 @@ Supported platforms

Currently the interface is compilable on and supports:

* the various Win32 and Win64 platforms targeting the Microsoft.NET and the MONO frameworks,
* the various Win32 and Win64 platforms targeting the Microsoft.NET and the MONO frameworks,
* GNU Linux/OSX systems using the MONO framework, and
* Unity systems on Windows, OSX and Linux (currently only the MONO framework and not IL2CPP).

Expand Down Expand Up @@ -57,9 +57,9 @@ Useful Links

* A variety of example programs in CSharp are available at the `/swig/csharp/apps <https://github.com/OSGeo/gdal/tree/master/swig/csharp/apps>`__ folder of the GDAL project tree.

* The Conda Feedstock
* The Conda Feedstock

* A simple (as is) build engine of GDAL 3.2 library for .NET Core. `MaxRev-Dev/gdal.netcore <https://github.com/MaxRev-Dev/gdal.netcore>`__
* A simple (as is) build engine of GDAL 3.2 library for .NET Core. `MaxRev-Dev/gdal.netcore <https://github.com/MaxRev-Dev/gdal.netcore>`__

* The `ViRGiS project <https://www.virgis.org/>`__ makes extensive use of GDAL in c# in a Unity environment.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/api/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Numpy
-------------

One advanced feature of the GDAL Python bindings not found in the other
language bindings (C#, Perl) is integration with the Python numerical array
language bindings is integration with the Python numerical array
facilities. The gdal.Dataset.ReadAsArray() method can be used to read raster
data as numerical arrays, ready to use with the Python numerical array
capabilities.
Expand Down
11 changes: 0 additions & 11 deletions mkgdaldist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,6 @@ echo "SWIG C# interfaces *NOT* generated !"
#./mkinterface.sh
#cd ${CWD}

#
# Generate SWIG interface for Perl
#
echo "* Generating SWIG Perl interfaces..."
CWD=${PWD}

rm -f swig/perl/*wrap*
touch GDALmake.opt
(cd swig/perl && ${MAKE} generate)
rm GDALmake.opt

#
# Make distribution packages
#
Expand Down
2 changes: 1 addition & 1 deletion swig/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include ../GDALmake.opt

# The ALL_BINDINGS variable defines all the possible bindings. It's used
# in the dist and clean definitions.
ALL_BINDINGS = python csharp perl java
ALL_BINDINGS = python csharp java

default: generate

Expand Down
113 changes: 5 additions & 108 deletions swig/include/Band.i
Original file line number Diff line number Diff line change
Expand Up @@ -90,55 +90,7 @@ GIntBig ComputeBandRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
}
%}

#if defined(SWIGPERL)
%{
static
CPLErr ReadRaster_internal( GDALRasterBandShadow *obj,
int xoff, int yoff, int xsize, int ysize,
int buf_xsize, int buf_ysize,
GDALDataType buf_type,
GIntBig *buf_size, char **buf,
GIntBig pixel_space, GIntBig line_space,
GDALRasterIOExtraArg* psExtraArg )
{
CPLErr result;

*buf_size = ComputeBandRasterIOSize( buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
pixel_space, line_space, FALSE );

if ( *buf_size == 0 )
{
*buf = 0;
return CE_Failure;
}

*buf = (char*) malloc( *buf_size );
if ( *buf )
{
result = GDALRasterIOEx( obj, GF_Read, xoff, yoff, xsize, ysize,
(void *) *buf, buf_xsize, buf_ysize,
buf_type, pixel_space, line_space, psExtraArg );
if ( result != CE_None )
{
free( *buf );
*buf = 0;
*buf_size = 0;
}
}
else
{
CPLError(CE_Failure, CPLE_OutOfMemory, "Not enough memory to allocate " CPL_FRMT_GIB " bytes", *buf_size);
result = CE_Failure;
*buf = 0;
*buf_size = 0;
}

return result;
}
%}
#endif

#if defined(SWIGPYTHON) || defined(SWIGPERL)
#if defined(SWIGPYTHON)
%{
static
CPLErr WriteRaster_internal( GDALRasterBandShadow *obj,
Expand Down Expand Up @@ -370,44 +322,7 @@ public:
return GDALFillRaster( self, real_fill, imag_fill );
}

#if defined(SWIGPERL)
%apply (GIntBig *nLen, char **pBuf) { (GIntBig *buf_len, char **buf) };
%apply (GIntBig *optional_GIntBig) { (GIntBig*) };
%apply ( int *optional_int ) {(int*)};
%feature( "kwargs" ) ReadRaster;
CPLErr ReadRaster( int xoff, int yoff, int xsize, int ysize,
GIntBig *buf_len, char **buf,
int *buf_xsize = 0,
int *buf_ysize = 0,
int *buf_type = 0,
GIntBig *buf_pixel_space = 0,
GIntBig *buf_line_space = 0,
GDALRIOResampleAlg resample_alg = GRIORA_NearestNeighbour,
GDALProgressFunc callback = NULL,
void* callback_data=NULL ) {
int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
GDALDataType ntype = (buf_type==0) ? GDALGetRasterDataType(self)
: (GDALDataType)*buf_type;
GIntBig pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
GIntBig line_space = (buf_line_space == 0) ? 0 : *buf_line_space;

GDALRasterIOExtraArg sExtraArg;
INIT_RASTERIO_EXTRA_ARG(sExtraArg);
sExtraArg.eResampleAlg = resample_alg;
sExtraArg.pfnProgress = callback;
sExtraArg.pProgressData = callback_data;

return ReadRaster_internal( self, xoff, yoff, xsize, ysize,
nxsize, nysize, ntype, buf_len, buf, pixel_space, line_space,
&sExtraArg );
}
%clear (GIntBig *buf_len, char **buf );
%clear (int*);
%clear (GIntBig*);
#endif

#if defined(SWIGPYTHON) || defined(SWIGPERL)
#if defined(SWIGPYTHON)
%apply (GIntBig nLen, char *pBuf) { (GIntBig buf_len, char *buf_string) };
%apply (GIntBig *optional_GIntBig) { (GIntBig*) };
%apply ( int *optional_int ) {(int*)};
Expand Down Expand Up @@ -488,11 +403,7 @@ public:
return GDALIsMaskBand( self );
}

#if defined(SWIGPYTHON) || defined(SWIGPERL)
#if defined(SWIGPERL)
%apply (int len, GUIntBig *output) {(int buckets, GUIntBig *panHistogram)};
%apply (IF_ERROR_RETURN_NONE) { (CPLErr) };
#endif
#if defined(SWIGPYTHON)
%feature( "kwargs" ) GetHistogram;
CPLErr GetHistogram( double min=-0.5,
double max=255.5,
Expand All @@ -508,10 +419,6 @@ public:
callback, callback_data );
return err;
}
#if defined(SWIGPERL)
%clear (int buckets, int *panHistogram);
%clear (CPLErr);
#endif
#else
#ifndef SWIGJAVA
#if defined(SWIGCSHARP)
Expand All @@ -538,12 +445,7 @@ public:
#endif
#endif

#if defined(SWIGPYTHON) || defined(SWIGPERL)
#if defined(SWIGPERL)
%apply (double *OUTPUT){double *min_ret, double *max_ret}
%apply (int *nLen, const GUIntBig **pList) {(int *buckets_ret, GUIntBig **ppanHistogram)};
%apply (IF_ERROR_RETURN_NONE) { (CPLErr) };
#endif
#if defined(SWIGPYTHON)
%feature ("kwargs") GetDefaultHistogram;
CPLErr GetDefaultHistogram( double *min_ret=NULL, double *max_ret=NULL, int *buckets_ret = NULL,
GUIntBig **ppanHistogram = NULL, int force = 1,
Expand All @@ -553,11 +455,6 @@ CPLErr GetDefaultHistogram( double *min_ret=NULL, double *max_ret=NULL, int *buc
ppanHistogram, force,
callback, callback_data );
}
#if defined(SWIGPERL)
%clear (double *min_ret, double *max_ret);
%clear (int *buckets_ret, int **ppanHistogram);
%clear (CPLErr);
#endif
#else
#ifndef SWIGJAVA
%feature ("kwargs") GetDefaultHistogram;
Expand All @@ -572,7 +469,7 @@ CPLErr GetDefaultHistogram( double *min_ret=NULL, double *max_ret=NULL, int *buc
#endif
#endif

#if defined(SWIGPYTHON) || defined(SWIGPERL)
#if defined(SWIGPYTHON)
%apply (int nList, GUIntBig* pList) {(int buckets_in, GUIntBig *panHistogram_in)}
CPLErr SetDefaultHistogram( double min, double max,
int buckets_in, GUIntBig *panHistogram_in ) {
Expand Down
Loading

0 comments on commit fa4d403

Please sign in to comment.