python313Packages.segyio: fix build

wxt 925fdc83 48d5c5fe

+105 -3
+7 -3
pkgs/development/python-modules/segyio/default.nix
··· 17 17 patches = [ 18 18 # https://github.com/equinor/segyio/pull/570 19 19 ./add_missing_cstdint.patch 20 + # https://github.com/equinor/segyio/pull/576/ 21 + ./fix-setuptools.patch 22 + ./explicitly-cast.patch 23 + ./numpy-2.patch 20 24 ]; 21 25 22 26 postPatch = '' ··· 49 53 numpy 50 54 ]; 51 55 52 - meta = with lib; { 56 + meta = { 53 57 description = "Fast Python library for SEGY files"; 54 58 homepage = "https://github.com/equinor/segyio"; 55 - license = licenses.lgpl3Only; 56 - maintainers = with maintainers; [ atila ]; 59 + license = lib.licenses.lgpl3Only; 60 + maintainers = with lib.maintainers; [ atila ]; 57 61 }; 58 62 }
+32
pkgs/development/python-modules/segyio/explicitly-cast.patch
··· 1 + From eafe8476566e1d8e8b9a486ca808685cb439a767 Mon Sep 17 00:00:00 2001 2 + From: Sveinung Rundhovde <ssru@equinor.com> 3 + Date: Mon, 29 Jul 2024 10:46:35 +0200 4 + Subject: [PATCH] Explicitly cast from BinField to int 5 + 6 + Parsing segyio.BinField type as int in PyArg_ParseTuple is no longer 7 + possible. 8 + --- 9 + python/segyio/open.py | 6 +++--- 10 + 1 file changed, 3 insertions(+), 3 deletions(-) 11 + 12 + diff --git a/python/segyio/open.py b/python/segyio/open.py 13 + index cd902c15..80bc3a5b 100644 14 + --- a/python/segyio/open.py 15 + +++ b/python/segyio/open.py 16 + @@ -166,8 +166,8 @@ def open(filename, mode="r", iline = 189, 17 + f = segyio.SegyFile(fd, 18 + filename = str(filename), 19 + mode = mode, 20 + - iline = iline, 21 + - xline = xline, 22 + + iline = int(iline), 23 + + xline = int(xline), 24 + endian = endian, 25 + ) 26 + 27 + @@ -189,4 +189,4 @@ def open(filename, mode="r", iline = 189, 28 + if ignore_geometry: 29 + return f 30 + 31 + - return infer_geometry(f, metrics, iline, xline, strict) 32 + + return infer_geometry(f, metrics, int(iline), int(xline), strict)
+32
pkgs/development/python-modules/segyio/fix-setuptools.patch
··· 1 + From 6df089258c2ef4356427263f652cff0c053c6173 Mon Sep 17 00:00:00 2001 2 + From: Sveinung Rundhovde <ssru@equinor.com> 3 + Date: Fri, 26 Jul 2024 15:03:33 +0200 4 + Subject: [PATCH] Fix attribute error in setup.py 5 + 6 + This line was causing a error due to an update to scikit-build. The 7 + issue was that the setuptools.command.test module is not put into the 8 + symbol table by the setuptools import, but it was put there during the 9 + skbuild import causing it to be available. Due to changes in 10 + scikit-build this is no longer the case and the line gives an 11 + AttributError. 12 + 13 + The rationale for this line was that scikit-builds test command implied 14 + develop (this was obnoxious), something that is no longer true. There is 15 + thus no longer any reason to keep this line, so we can fix this issue by 16 + simply removing it. 17 + --- 18 + python/setup.py | 1 - 19 + 1 file changed, 1 deletion(-) 20 + 21 + diff --git a/python/setup.py b/python/setup.py 22 + index 6c6553bc..6bae62f0 100644 23 + --- a/python/setup.py 24 + +++ b/python/setup.py 25 + @@ -95,7 +95,6 @@ def src(x): 26 + # supported OS X release 10.9 27 + '-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9', 28 + ], 29 + - cmdclass = { 'test': setuptools.command.test.test }, 30 + classifiers = [ 31 + 'Development Status :: 5 - Production/Stable', 32 + 'Environment :: Other Environment',
+34
pkgs/development/python-modules/segyio/numpy-2.patch
··· 1 + From 75b2156a6414e2464eb15663004b8ab928374135 Mon Sep 17 00:00:00 2001 2 + From: Sveinung Rundhovde <ssru@equinor.com> 3 + Date: Tue, 30 Jul 2024 08:32:56 +0200 4 + Subject: [PATCH] Fix test failing due to Numpy 2.0 promotion rules 5 + 6 + From Numpy 2.0 adding a numpy.float32 and a Python numeric type returns 7 + a numy.float32 when it previously returned a numpy.float64. This changes 8 + the behavior when using the Python builtin sum function on a 9 + numpy.float32 array as the internal computations now will be performed 10 + as numpy.float32 additions when it used to be numpy.float64. 11 + 12 + Passing a numpy.double(0) as a start value to the innermost sum forces 13 + the old behavior and provides consistent results for Numpy 1 and 2. 14 + --- 15 + python/test/segyio_c.py | 4 ++-- 16 + 1 file changed, 2 insertions(+), 2 deletions(-) 17 + 18 + diff --git a/python/test/segyio_c.py b/python/test/segyio_c.py 19 + index 45fe95d89..b1e144d9d 100644 20 + --- a/python/test/segyio_c.py 21 + +++ b/python/test/segyio_c.py 22 + @@ -540,10 +540,10 @@ def read_line(f, metrics, iline_idx, xline_idx): 23 + buf = numpy.zeros((len(iline_idx), samples), dtype=numpy.single) 24 + 25 + f.getline(xline_trace0, len(iline_idx), xline_stride, offsets, buf) 26 + - assert sum(sum(buf)) == approx(800.061169624, abs=1e-6) 27 + + assert sum(sum(buf), numpy.double(0)) == approx(800.061169624, abs=1e-6) 28 + 29 + f.getline(iline_trace0, len(xline_idx), iline_stride, offsets, buf) 30 + - assert sum(sum(buf)) == approx(305.061146736, abs=1e-6) 31 + + assert sum(sum(buf), numpy.double(0)) == approx(305.061146736, abs=1e-6) 32 + 33 + f.close() 34 +