[Git][debian-gis-team/python-hdf4][upstream] New upstream version 0.11.4

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Thu Mar 28 10:06:02 GMT 2024



Antonio Valentino pushed to branch upstream at Debian GIS Project / python-hdf4


Commits:
2faa70f8 by Antonio Valentino at 2024-03-28T09:49:38+00:00
New upstream version 0.11.4
- - - - -


6 changed files:

- doc/conf.py
- pyhdf/hdfext.i
- pyhdf/hdfext_wrap.c
- pyhdf/test_SD.py
- pyproject.toml
- setup.py


Changes:

=====================================
doc/conf.py
=====================================
@@ -56,7 +56,7 @@ copyright = u'2019, pyhdf authors'
 # The short X.Y version.
 version = '0.11'
 # The full version, including alpha/beta/rc tags.
-release = '0.11.3'
+release = '0.11.4'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
pyhdf/hdfext.i
=====================================
@@ -325,14 +325,17 @@ static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
         }
 
         /*
-         * Create output numpy array.
+         * Create output numpy array. We provide 1 for the itemsize argument to
+         * PyArray_New to handle to case when num_type is NPY_STRING. All other
+         * num_type possibilities are fixed-size types, so itemsize is ignored.
          */
     if ((num_type = HDFtoNumericType(data_type)) < 0)    {
         PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy");
         return NULL;
         }
-    if ((array = (PyArrayObject *)
-                 PyArray_SimpleNew(outRank, dims, num_type)) == NULL)
+    array = (PyArrayObject *)PyArray_New(&PyArray_Type, outRank, dims, num_type,
+                                         NULL, NULL, 1, 0, NULL);
+    if (array == NULL)
         return NULL;
         /*
          * Load it from the SDS.


=====================================
pyhdf/hdfext_wrap.c
=====================================
@@ -3964,14 +3964,17 @@ static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
         }
 
         /*
-         * Create output numpy array.
+         * Create output numpy array. We provide 1 for the itemsize argument to
+         * PyArray_New to handle to case when num_type is NPY_STRING. All other
+         * num_type possibilities are fixed-size types, so itemsize is ignored.
          */
     if ((num_type = HDFtoNumericType(data_type)) < 0)    {
         PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy");
         return NULL;
         }
-    if ((array = (PyArrayObject *)
-                 PyArray_SimpleNew(outRank, dims, num_type)) == NULL)
+    array = (PyArrayObject *)PyArray_New(&PyArray_Type, outRank, dims, num_type,
+                                         NULL, NULL, 1, 0, NULL);
+    if (array == NULL)
         return NULL;
         /*
          * Load it from the SDS.


=====================================
pyhdf/test_SD.py
=====================================
@@ -6,6 +6,7 @@ import pyhdf.SD
 import shutil
 import tempfile
 from numpy.testing import assert_array_equal
+from pathlib import Path
 from pyhdf.SD import SDC
 
 def test_long_varname():
@@ -61,3 +62,11 @@ def test_negative_int8():
         sd.end()
     finally:
         shutil.rmtree(temp)
+
+def test_char():
+    with tempfile.TemporaryDirectory() as temp_dir:
+        hdf_file = str(Path(temp_dir) / "test.hdf")
+        sd = pyhdf.SD.SD(hdf_file, SDC.WRITE | SDC.CREATE)
+        sds = sd.create("test_sds", SDC.CHAR, [5])
+        sds[:] = "ABCDE"
+        assert_array_equal(sds[:], np.array(list("ABCDE"), "S2"))


=====================================
pyproject.toml
=====================================
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "pyhdf"
-version = "0.11.3"
+version = "0.11.4"
 description = "Python interface to the NCSA HDF4 library"
 readme = "README.md"
 keywords = ['hdf4', 'netcdf', 'numpy', 'python', 'pyhdf']
@@ -34,7 +34,9 @@ authors = [
 maintainers = [
 	{name = "Fazlul Shahriar", email = "fshahriar at gmail.com"},
 ]
-dependencies = []
+dependencies = [
+	"numpy"
+]
 
 [project.urls]
 Homepage = 'https://github.com/fhs/pyhdf'


=====================================
setup.py
=====================================
@@ -4,6 +4,7 @@ import sys
 import os
 import os.path as path
 import shlex
+import sysconfig
 
 from setuptools import Extension, setup
 import numpy as np
@@ -31,6 +32,7 @@ def _use_hdf4alt(libdirs):
     if not sys.platform.startswith("linux"):
         return False
     libdirs.extend(os.environ.get("LD_LIBRARY_PATH", "").split(os.pathsep))
+    libdirs.append("/usr/lib/%s" % sysconfig.get_config_var('MULTIARCH'))
     libdirs.append("/usr/lib")
     libdirs.append("/usr/local/lib")
     libdirs.append("/lib")



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

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-hdf4/-/commit/2faa70f8099f6a4cb0f6bbf508edb7d9fd904712
You're receiving this email because of your account on salsa.debian.org.


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


More information about the Pkg-grass-devel mailing list