[Git][debian-gis-team/jeolib-jiplib][master] 2 commits: Add patch to fix FTBFS with SWIG 4.5.0. (closes: #1145401)

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Mon Aug 24 20:03:22 BST 2026



Bas Couwenberg pushed to branch master at Debian GIS Project / jeolib-jiplib


Commits:
3fc85f75 by Bas Couwenberg at 2026-08-24T20:38:00+02:00
Add patch to fix FTBFS with SWIG 4.5.0. (closes: #1145401)

- - - - -
3901d9fa by Bas Couwenberg at 2026-08-24T20:38:17+02:00
Set distribution to unstable.

- - - - -


3 changed files:

- debian/changelog
- debian/patches/series
- + debian/patches/swig-4.5.0.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+jeolib-jiplib (1.2.1+ds-2) unstable; urgency=medium
+
+  * Team upload.
+  * Add patch to fix FTBFS with SWIG 4.5.0.
+    (closes: #1145401)
+
+ -- Bas Couwenberg <sebastic at debian.org>  Mon, 24 Aug 2026 20:38:02 +0200
+
 jeolib-jiplib (1.2.1+ds-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 pip-break-sys-pkg.patch
 wheel.patch
+swig-4.5.0.patch


=====================================
debian/patches/swig-4.5.0.patch
=====================================
@@ -0,0 +1,187 @@
+Description: Don't use Python 2 C API macros, removed in SWIG 4.5.0.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://github.com/ec-jrc/jeolib-jiplib/pull/13
+
+--- a/src/swig/jiplib.i
++++ b/src/swig/jiplib.i
+@@ -90,11 +90,11 @@ along with jiplib.  If not, see <https:/
+     while (PyDict_Next($input, &ppos, &pKey, &pValue)) {
+       std::string theKey;
+       std::string theValue;
+-      if(PyString_Check(pKey)){
+-        theKey=PyString_AsString(pKey);
++      if(PyBytes_Check(pKey)){
++        theKey=PyBytes_AsString(pKey);
+       }
+       else if(PyUnicode_Check(pKey)){
+-        theKey=PyString_AsString(PyUnicode_AsUTF8String(pKey));
++        theKey=PyBytes_AsString(PyUnicode_AsUTF8String(pKey));
+       }
+       else{
+         PyErr_SetString(PyExc_TypeError,"Expected a string.");
+@@ -106,16 +106,16 @@ along with jiplib.  If not, see <https:/
+         for(Py_ssize_t i=0;i<PyList_Size(pValue);++i){
+           PyObject *rValue;
+           rValue=PyList_GetItem(pValue,i);
+-          if (PyString_Check(rValue))
+-            theValue=PyString_AsString(rValue);
++          if (PyBytes_Check(rValue))
++            theValue=PyBytes_AsString(rValue);
+           else if (PyUnicode_Check(rValue))
+-            theValue = PyString_AsString(PyUnicode_AsUTF8String(rValue));
++            theValue = PyBytes_AsString(PyUnicode_AsUTF8String(rValue));
+           else if(rValue != Py_None){
+             PyObject *tmp_obj = PyObject_Repr(rValue);
+-            if (PyString_Check(tmp_obj))
+-              theValue=PyString_AsString(tmp_obj);
++            if (PyBytes_Check(tmp_obj))
++              theValue=PyBytes_AsString(tmp_obj);
+             else if (PyUnicode_Check(tmp_obj))
+-              theValue=PyString_AsString(PyUnicode_AsUTF8String(tmp_obj));
++              theValue=PyBytes_AsString(PyUnicode_AsUTF8String(tmp_obj));
+           }
+           else{
+             PyErr_SetString(PyExc_TypeError,"Expected a string.");
+@@ -125,12 +125,12 @@ along with jiplib.  If not, see <https:/
+         }
+         continue;
+       }
+-      else if(PyString_Check(pValue)){
+-        theValue=PyString_AsString(pValue);
++      else if(PyBytes_Check(pValue)){
++        theValue=PyBytes_AsString(pValue);
+         $1->pushLongOption(theKey,theValue);
+       }
+       else if (PyUnicode_Check(pValue)){
+-        theValue = PyString_AsString(PyUnicode_AsUTF8String(pValue));
++        theValue = PyBytes_AsString(PyUnicode_AsUTF8String(pValue));
+         $1->pushLongOption(theKey,theValue);
+       }
+       else if(PyBool_Check(pValue)){
+@@ -143,10 +143,10 @@ along with jiplib.  If not, see <https:/
+       }
+       else if(pValue != Py_None){
+         PyObject *tmp_obj = PyObject_Repr(pValue);
+-        if (PyString_Check(tmp_obj))
+-          theValue=PyString_AsString(tmp_obj);
++        if (PyBytes_Check(tmp_obj))
++          theValue=PyBytes_AsString(tmp_obj);
+         else if (PyUnicode_Check(tmp_obj))
+-          theValue=PyString_AsString(PyUnicode_AsUTF8String(tmp_obj));
++          theValue=PyBytes_AsString(PyUnicode_AsUTF8String(tmp_obj));
+         $1->pushLongOption(theKey,theValue);
+       }
+     }
+@@ -411,7 +411,7 @@ along with jiplib.  If not, see <https:/
+  }
+ 
+ %typemap(argout) unsigned long int* ofs{
+-  %append_output(PyInt_FromLong(*$1));
++  %append_output(PyLong_FromLong(*$1));
+  }
+ 
+ %typemap(in) double* gt(double temp[6]){
+@@ -468,7 +468,7 @@ along with jiplib.  If not, see <https:/
+   pyList=PyList_New(n);
+   for (i=0; i<n; i++) {
+     std::string theField=(*$1).at(i);
+-    PyList_SET_ITEM(pyList, i, PyString_FromString(theField.c_str()));
++    PyList_SET_ITEM(pyList, i, PyUnicode_FromString(theField.c_str()));
+   }
+   $result = pyList;
+ }
+@@ -649,11 +649,11 @@ along with jiplib.  If not, see <https:/
+           PyList_Append(lh,PyFloat_FromDouble(histValue));
+         }
+         std::string keyBin="bin";
+-        PyDict_SetItem(d, PyString_FromString(keyBin.c_str()), lb);
+-        PyDict_SetItem(d, PyString_FromString(key.c_str()), lh);
++        PyDict_SetItem(d, PyUnicode_FromString(keyBin.c_str()), lb);
++        PyDict_SetItem(d, PyUnicode_FromString(key.c_str()), lh);
+       }
+       else if(val.find("[")==std::string::npos)
+-          PyDict_SetItem(d, PyString_FromString(key.c_str()), PyFloat_FromDouble(std::stod(val.c_str())));
++          PyDict_SetItem(d, PyUnicode_FromString(key.c_str()), PyFloat_FromDouble(std::stod(val.c_str())));
+       else{
+         PyObject *lb = PyList_New(0);
+         val.erase(std::remove(val.begin(), val.end(), '['), val.end());
+@@ -667,7 +667,7 @@ along with jiplib.  If not, see <https:/
+           if (ss.peek() == ',')
+             ss.ignore();
+         }
+-        PyDict_SetItem(d, PyString_FromString(key.c_str()), lb);
++        PyDict_SetItem(d, PyUnicode_FromString(key.c_str()), lb);
+       }
+       ++mit;
+     }
+@@ -676,16 +676,16 @@ along with jiplib.  If not, see <https:/
+ /* } */
+ 
+ /* %typemap(out) std::string getUniquePixels { */
+-/*   $result=PyString_FromString($1.c_str()); */
++/*   $result=PyUnicode_FromString($1.c_str()); */
+ /*  } */
+ /* %typemap(out) std::map<std::vector<unsigned short>,unsigned short>& getUniquePixels { */
+-/*     $result=PyString_FromString("hello"); */
++/*     $result=PyUnicode_FromString("hello"); */
+ /* } */
+ /* %typemap(out) std::map<unsigned short,unsigned short> getUniquePixels { */
+-/*     $result=PyString_FromString("hello"); */
++/*     $result=PyUnicode_FromString("hello"); */
+ /* } */
+ /* %typemap(out) std::vector<unsigned short> getUniquePixels { */
+-/*   $result=PyString_FromString("hello"); */
++/*   $result=PyUnicode_FromString("hello"); */
+ /* } */
+ //convert map to PyDict
+ /* %typemap(out) std::map<std::vector<unsigned short>,std::vector<std::pair<unsigned short,unsigned short> > > getUniquePixels { */
+@@ -695,15 +695,15 @@ along with jiplib.  If not, see <https:/
+ /*     std::vector<unsigned short> pv=mit->first; */
+ /*     PyObject *pyv = PyList_New(mit->first.size()); */
+ /*     for(int index=0;index<mit->first.size();++index) */
+-/*       PyList_SetItem(pyv, index,PyInt_FromLong(mit->first[index])); */
++/*       PyList_SetItem(pyv, index,PyLong_FromLong(mit->first[index])); */
+ /*     PyObject *coordinates = PyList_New(mit->second.size()); */
+ /*     //construct dictionary as list of values */
+ /*     for(int icoord=0;icoord<mit->second.size();++icoord){ */
+ /*       PyObject *lc = PyList_New(2); */
+ /*       unsigned int xcoord=mit->second[icoord].first; */
+ /*       unsigned int ycoord=mit->second[icoord].second; */
+-/*       PyList_SetItem(lc,0,PyInt_FromLong(xcoord)); */
+-/*       PyList_SetItem(lc,1,PyInt_FromLong(ycoord)); */
++/*       PyList_SetItem(lc,0,PyLong_FromLong(xcoord)); */
++/*       PyList_SetItem(lc,1,PyLong_FromLong(ycoord)); */
+ /*       PyList_SetItem(coordinates,icoord,lc); */
+ /*     } */
+ /*     PyDict_SetItem(d, pyv, coordinates); */
+@@ -973,7 +973,7 @@ along with jiplib.  If not, see <https:/
+           PyList_SET_ITEM(pyListVector[ifield], ifeature, PyFloat_FromDouble(thisFeature->GetFieldAsDouble(*fit)));
+           break;
+         case(OFTString):
+-          PyList_SET_ITEM(pyListVector[ifield], ifeature, PyString_FromString(thisFeature->GetFieldAsString(*fit)));
++          PyList_SET_ITEM(pyListVector[ifield], ifeature, PyUnicode_FromString(thisFeature->GetFieldAsString(*fit)));
+           break;
+         case(OFTInteger):
+         case(OFTInteger64):
+@@ -1005,7 +1005,7 @@ along with jiplib.  If not, see <https:/
+     PyObject *returnDict = PyDict_New();
+     for(std::vector<size_t>::const_iterator fit=fieldindexes.begin();fit!=fieldindexes.end();++fit){
+       std::string key = fields[*fit]->GetNameRef();
+-      PyDict_SetItem(returnDict, PyString_FromString(key.c_str()), pyListVector[ifield]);
++      PyDict_SetItem(returnDict, PyUnicode_FromString(key.c_str()), pyListVector[ifield]);
+       ++ifield;
+     }
+     if(returnDict)
+--- a/src/swig/miallib_tmp.i
++++ b/src/swig/miallib_tmp.i
+@@ -39,8 +39,8 @@ along with jiplib.  If not, see <https:/
+     for (i = 0; i < dim; i++) {
+       PyObject *o = PySequence_GetItem($input,i);
+       // https://docs.python.org/3.5/c-api/long.html
+-      if (PyInt_Check(o)) {
+-	$1[i] = (int)PyInt_AsLong(o);
++      if (PyLong_Check(o)) {
++	$1[i] = (int)PyLong_AsLong(o);
+       }
+       else {
+ 	PyErr_SetString(PyExc_ValueError,"Sequence elements must be integers");



View it on GitLab: https://salsa.debian.org/debian-gis-team/jeolib-jiplib/-/compare/6128d1428ddfaf09c07f12e12f5658d02fbffad4...3901d9fa6513e738957382539621408151f6ccc3

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/jeolib-jiplib/-/compare/6128d1428ddfaf09c07f12e12f5658d02fbffad4...3901d9fa6513e738957382539621408151f6ccc3
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20260824/ce19128c/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list