[Git][debian-gis-team/python-hdf4][master] Add patch to fix FTBFS with HDF 4.4.0. (closes: #1146659)

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Fri Sep 4 14:24:59 BST 2026



Bas Couwenberg pushed to branch master at Debian GIS Project / python-hdf4


Commits:
e1ac9cbc by Bas Couwenberg at 2026-09-04T15:24:29+02:00
Add patch to fix FTBFS with HDF 4.4.0. (closes: #1146659)

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/hdf-4.4.patch
- + debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+python-hdf4 (0.11.7-3) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Add patch to fix FTBFS with HDF 4.4.0.
+    (closes: #1146659)
+
+ -- Bas Couwenberg <sebastic at debian.org>  Fri, 04 Sep 2026 14:47:45 +0200
+
 python-hdf4 (0.11.7-2) unstable; urgency=medium
 
   * debian/patches:


=====================================
debian/patches/hdf-4.4.patch
=====================================
@@ -0,0 +1,126 @@
+Description: Fix FTBFS with HDF 4.4.0.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://github.com/fhs/pyhdf/pull/88
+
+--- a/pyhdf/hdfext.i
++++ b/pyhdf/hdfext.i
+@@ -127,6 +127,7 @@ typedef unsigned char uint8;
+ %{
+ #include "hdf.h"
+ #include "mfhdf.h"
++#include "hfile.h"
+ %}
+ 
+ /*
+@@ -912,16 +913,28 @@ extern int32  Vattach(int32 file_id,
+ extern int32 Vdetach(int32 vgroup_id);
+ 
+ %cstring_bounded_output(char *name, CHAR_BUFFER_SIZE);
++#if LIBVER_MAJOR == 4 && LIBVER_MINOR >= 4
++extern int32 Vgetname(int32 vgroup_id,
++                      char *name,
++                      size_t *buf_size);
++#else
+ extern int32 Vgetname(int32 vgroup_id,
+                       char *name);
++#endif
+ %clear char *name;
+ 
+ extern int32 Vsetname(int32 vgroup_id,
+                       const char *vgroup_name);
+ 
+ %cstring_bounded_output(char *name, CHAR_BUFFER_SIZE);
++#if LIBVER_MAJOR == 4 && LIBVER_MINOR >= 4
++extern int32 Vgetclass(int32 vgroup_id,
++                       char *name,
++                       size_t *buf_size);
++#else
+ extern int32 Vgetclass(int32 vgroup_id,
+                        char *name);
++#endif
+ %clear char *name;
+ 
+ extern int32 Vsetclass(int32 vgroup_id,
+--- a/pyhdf/hdfext_wrap.c
++++ b/pyhdf/hdfext_wrap.c
+@@ -4148,6 +4148,7 @@ SWIGINTERN array_float64 *array_float64_
+ 
+ #include "hdf.h"
+ #include "mfhdf.h"
++#include "hfile.h"
+ 
+ 
+ SWIGINTERN swig_type_info*
+@@ -9657,7 +9658,12 @@ SWIGINTERN PyObject *_wrap_Vgetname(PyOb
+     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetname" "', argument " "1"" of type '" "int32""'");
+   } 
+   arg1 = (int32)(val1);
++#if LIBVER_MAJOR == 4 && LIBVER_MINOR >= 4
++  size_t buf_size = sizeof(arg2);
++  result = (int32)Vgetname(arg1,arg2,&buf_size);
++#else
+   result = (int32)Vgetname(arg1,arg2);
++#endif
+   resultobj = SWIG_From_int((int)(result));
+   arg2[4096] = 0;  
+   resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2), 0);
+@@ -9720,7 +9726,12 @@ SWIGINTERN PyObject *_wrap_Vgetclass(PyO
+     SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Vgetclass" "', argument " "1"" of type '" "int32""'");
+   } 
+   arg1 = (int32)(val1);
++#if LIBVER_MAJOR == 4 && LIBVER_MINOR >= 4
++  size_t buf_size = sizeof(arg2);
++  result = (int32)Vgetclass(arg1,arg2,&buf_size);
++#else
+   result = (int32)Vgetclass(arg1,arg2);
++#endif
+   resultobj = SWIG_From_int((int)(result));
+   arg2[4096] = 0;  
+   resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2), 0);
+--- a/setup.py
++++ b/setup.py
+@@ -4,6 +4,7 @@ import sys
+ import os
+ import os.path as path
+ import shlex
++import subprocess
+ import sysconfig
+ 
+ from setuptools import Extension, setup
+@@ -44,11 +45,27 @@ def _use_hdf4alt(libdirs):
+     return False
+ 
+ 
++def _get_hdf_version():
++    cmd = ['pkg-config', '--modversion', 'hdf']
++    try:
++        p = subprocess.run(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
++        v = p.stdout.decode().rstrip().split('.')
++        version = {
++            'major': int(v[0]),
++            'minor': int(v[1]),
++            'patch': int(v[2]),
++        }
++    except Exception:
++        version = None
++    return version
++
++
+ include_dirs = _find_args("-i", "INCLUDE_DIRS")
+ library_dirs = _find_args("-l", "LIBRARY_DIRS")
+ szip_installed = "SZIP" in os.environ
+ compress = "NO_COMPRESS" not in os.environ
+ extra_link_args = None
++hdf_version = _get_hdf_version()
+ if "LINK_ARGS" in os.environ:
+     extra_link_args = shlex.split(os.environ["LINK_ARGS"])
+ 
+@@ -75,6 +92,8 @@ if sys.platform == "win32":
+     libraries = ["mfhdf", "hdf", "xdr"]
+ elif _use_hdf4alt(library_dirs):
+     libraries = ["mfhdfalt", "dfalt"]
++elif hdf_version and hdf_version['major'] == 4 and hdf_version['minor'] >= 4:
++    libraries = ["mfhdf", "hdf"]
+ else:
+     libraries = ["mfhdf", "df"]
+ 


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+hdf-4.4.patch



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-hdf4/-/commit/e1ac9cbcac6074b4b4b645b579d623c67e154c58

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-hdf4/-/commit/e1ac9cbcac6074b4b4b645b579d623c67e154c58
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/20260904/7cdb2d98/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list