[Git][debian-gis-team/pylibtiff][master] 4 commits: New 0003-Compatibility-with-numpy2.patch

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Tue Jan 28 21:21:37 GMT 2025



Antonio Valentino pushed to branch master at Debian GIS Project / pylibtiff


Commits:
f910ea49 by Antonio Valentino at 2025-01-28T19:16:21+00:00
New 0003-Compatibility-with-numpy2.patch

- - - - -
7ed629aa by Antonio Valentino at 2025-01-28T19:18:01+00:00
Update dates in d/copyright

- - - - -
1abbcf56 by Antonio Valentino at 2025-01-28T21:10:43+00:00
Call dh_numpy3 -p python3-libtiff explicitly

- - - - -
e62f6cb6 by Antonio Valentino at 2025-01-28T21:11:15+00:00
Set distribution to unstable

- - - - -


5 changed files:

- debian/changelog
- debian/copyright
- + debian/patches/0003-Compatibility-with-numpy2.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,9 +1,16 @@
-pylibtiff (0.6.1-2) UNRELEASED; urgency=medium
+pylibtiff (0.6.1-2) unstable; urgency=medium
 
-  * Team upload.
+  [ Bas Couwenberg ]
   * Bump Standards-Version to 4.7.0, no changes.
 
- -- Bas Couwenberg <sebastic at debian.org>  Sun, 28 Jul 2024 19:54:04 +0200
+  [ Antonio Valentino ]
+  * debian/patches:
+    - 0003-Compatibility-with-numpy2.patch (Closes: #1094332).
+  * Update dates in d/copyright.
+  * debian/rules:
+    - Call dh_numpy3 -p python3-libtiff explicitly.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Tue, 28 Jan 2025 21:10:50 +0000
 
 pylibtiff (0.6.1-1) unstable; urgency=medium
 


=====================================
debian/copyright
=====================================
@@ -51,7 +51,7 @@ License: BSD-tiff-ish
 Files: debian/*
 Copyright: 2011, Mathieu Malaterre <mathieu.malaterre at gmail.com>
            2015, Andreas Tille <tille at debian.org>
-           2018-2023, Antonio Valentino <antonio.valentino at tiscali.it>
+           2018-2025, Antonio Valentino <antonio.valentino at tiscali.it>
 License: BSD-3-clause
 
 License: BSD-3-clause


=====================================
debian/patches/0003-Compatibility-with-numpy2.patch
=====================================
@@ -0,0 +1,93 @@
+From: Antonio Valentino <antonio.valentino at tiscali.it>
+Date: Tue, 28 Jan 2025 07:25:47 +0000
+Subject: Compatibility with numpy2
+
+Forwarded: https://github.com/pearu/pylibtiff/pull/186
+---
+ libtiff/libtiff_ctypes.py | 16 ++++++++--------
+ libtiff/test_bittools.py  |  4 +++-
+ libtiff/tiff_image.py     |  2 +-
+ libtiff/utils.py          |  1 +
+ 4 files changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/libtiff/libtiff_ctypes.py b/libtiff/libtiff_ctypes.py
+index 5202747..c776846 100644
+--- a/libtiff/libtiff_ctypes.py
++++ b/libtiff/libtiff_ctypes.py
+@@ -659,13 +659,13 @@ class TIFF(ctypes.c_void_p):
+         compression = self._fix_compression(compression)
+ 
+         arr = np.ascontiguousarray(arr)
+-        if arr.dtype in np.sctypes['float']:
++        if np.issubdtype(arr.dtype, np.floating):
+             sample_format = SAMPLEFORMAT_IEEEFP
+-        elif arr.dtype in np.sctypes['uint'] + [np.bool_]:
++        elif np.issubdtype(arr.dtype, np.unsignedinteger) or np.issubdtype(arr.dtype, np.bool_):
+             sample_format = SAMPLEFORMAT_UINT
+-        elif arr.dtype in np.sctypes['int']:
++        elif np.issubdtype(arr.dtype, np.signedinteger):
+             sample_format = SAMPLEFORMAT_INT
+-        elif arr.dtype in np.sctypes['complex']:
++        elif np.issubdtype(arr.dtype, np.complexfloating):
+             sample_format = SAMPLEFORMAT_COMPLEXIEEEFP
+         else:
+             raise NotImplementedError(repr(arr.dtype))
+@@ -746,13 +746,13 @@ class TIFF(ctypes.c_void_p):
+                     compression=None, write_rgb=False):
+         compression = self._fix_compression(compression)
+ 
+-        if arr.dtype in np.sctypes['float']:
++        if np.issubdtype(arr.dtype, np.floating):
+             sample_format = SAMPLEFORMAT_IEEEFP
+-        elif arr.dtype in np.sctypes['uint'] + [np.bool_]:
++        elif np.issubdtype(arr.dtype, np.unsignedinteger) or np.issubdtype(arr.dtype, np.bool_):
+             sample_format = SAMPLEFORMAT_UINT
+-        elif arr.dtype in np.sctypes['int']:
++        elif np.issubdtype(arr.dtype, np.signedinteger):
+             sample_format = SAMPLEFORMAT_INT
+-        elif arr.dtype in np.sctypes['complex']:
++        elif np.issubdtype(arr.dtype, np.complexfloating):
+             sample_format = SAMPLEFORMAT_COMPLEXIEEEFP
+         else:
+             raise NotImplementedError(repr(arr.dtype))
+diff --git a/libtiff/test_bittools.py b/libtiff/test_bittools.py
+index a173525..c6cba41 100644
+--- a/libtiff/test_bittools.py
++++ b/libtiff/test_bittools.py
+@@ -19,8 +19,10 @@ def test_setgetbit():
+ 
+ 
+ def test_setgetword():
++    arange = numpy.arange(-256, 256)
+     for dtype in [numpy.ubyte, numpy.int32, numpy.float64]:
+-        arr = numpy.array(list(range(-256, 256)), dtype=dtype)
++        # arr = numpy.array(list(range(-256, 256)), dtype=dtype)
++        arr = arange.astype(dtype)
+         arr2 = numpy.zeros(arr.shape, dtype=arr.dtype)
+         for i in range(arr.nbytes):
+             word, next = bittools.getword(arr, i * 8, 8)
+diff --git a/libtiff/tiff_image.py b/libtiff/tiff_image.py
+index 717370a..8e31d0e 100644
+--- a/libtiff/tiff_image.py
++++ b/libtiff/tiff_image.py
+@@ -437,7 +437,7 @@ class TIFFimage:
+ 
+         if compressed_data_size != image_data_size:
+             sdiff = image_data_size - compressed_data_size
+-            total_size -= sdiff
++            total_size = int(total_size) - sdiff
+             base = tif._mmap
+             if base is None:
+                 base = tif.base
+diff --git a/libtiff/utils.py b/libtiff/utils.py
+index 7fcfde4..d11d785 100644
+--- a/libtiff/utils.py
++++ b/libtiff/utils.py
+@@ -19,6 +19,7 @@ def isindisk(path):
+ 
+ def bytes2str(bytes):
+     lst = []
++    bytes = int(bytes)
+     Pbytes = bytes // 1024**5
+     if Pbytes:
+         lst.append('%sPi' % (Pbytes))


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 0001-Disable-bittools-extension.patch
 0002-Robust-definition-list-generation.patch
+0003-Compatibility-with-numpy2.patch


=====================================
debian/rules
=====================================
@@ -17,3 +17,6 @@ endif
 
 %:
 	dh $@ --buildsystem=pybuild
+
+override_dh_numpy3:
+	dh_numpy3 -p python3-libtiff



View it on GitLab: https://salsa.debian.org/debian-gis-team/pylibtiff/-/compare/51b4405373a11476e190822776ee8ed41b16dd06...e62f6cb69ab79caf992376e98a92490cfea4a0ac

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pylibtiff/-/compare/51b4405373a11476e190822776ee8ed41b16dd06...e62f6cb69ab79caf992376e98a92490cfea4a0ac
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/20250128/88dd8be2/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list