python313Packages.segyio: fix build
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
From 64f06c0643f1f8691a8f2757496b60f1ab98c866 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Sa=C3=AFd=20Benaissa?= <sbenaissa@shearwatergeo.com>
|
||||
Date: Fri, 8 Dec 2023 21:51:32 +0100
|
||||
Subject: [PATCH] Add include for cstdint, fix segyio build on fedora
|
||||
|
||||
---
|
||||
lib/experimental/segyio/segyio.hpp | 1 +
|
||||
python/segyio/segyio.cpp | 1 +
|
||||
python/setup.py | 2 +-
|
||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/experimental/segyio/segyio.hpp b/lib/experimental/segyio/segyio.hpp
|
||||
index 706f07ff5..7ba3ffb99 100644
|
||||
--- a/lib/experimental/segyio/segyio.hpp
|
||||
+++ b/lib/experimental/segyio/segyio.hpp
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <segyio/segy.h>
|
||||
+#include <cstdint>
|
||||
|
||||
/*
|
||||
* KNOWN ISSUES AND TODOs:
|
||||
diff --git a/python/segyio/segyio.cpp b/python/segyio/segyio.cpp
|
||||
index 76da965c3..bd8a8622e 100644
|
||||
--- a/python/segyio/segyio.cpp
|
||||
+++ b/python/segyio/segyio.cpp
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
+#include <cstdint>
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define IS_PY3K
|
||||
diff --git a/python/setup.py b/python/setup.py
|
||||
index 6c6553bc7..654075be9 100644
|
||||
--- a/python/setup.py
|
||||
+++ b/python/setup.py
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
-import skbuild
|
||||
+import skbuild # pip install scikit-build
|
||||
import setuptools
|
||||
|
||||
long_description = """
|
||||
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
ninja,
|
||||
scikit-build,
|
||||
@@ -15,12 +16,11 @@ buildPythonPackage rec {
|
||||
pyproject = false; # Built with cmake
|
||||
|
||||
patches = [
|
||||
# https://github.com/equinor/segyio/pull/570
|
||||
./add_missing_cstdint.patch
|
||||
# https://github.com/equinor/segyio/pull/576/
|
||||
./fix-setuptools.patch
|
||||
./explicitly-cast.patch
|
||||
./numpy-2.patch
|
||||
# Bump minimum CMake version to 3.11
|
||||
(fetchpatch {
|
||||
url = "https://github.com/equinor/segyio/commit/3e2cbe6ca6d4bc7d4f4d95666f5d2983836e8461.patch?full_index=1";
|
||||
hash = "sha256-sOBHi8meMSkxEZy0AXwebAnIVPatpwQHd+4Co5zIhLQ=";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
From eafe8476566e1d8e8b9a486ca808685cb439a767 Mon Sep 17 00:00:00 2001
|
||||
From: Sveinung Rundhovde <ssru@equinor.com>
|
||||
Date: Mon, 29 Jul 2024 10:46:35 +0200
|
||||
Subject: [PATCH] Explicitly cast from BinField to int
|
||||
|
||||
Parsing segyio.BinField type as int in PyArg_ParseTuple is no longer
|
||||
possible.
|
||||
---
|
||||
python/segyio/open.py | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/python/segyio/open.py b/python/segyio/open.py
|
||||
index cd902c15..80bc3a5b 100644
|
||||
--- a/python/segyio/open.py
|
||||
+++ b/python/segyio/open.py
|
||||
@@ -166,8 +166,8 @@ def open(filename, mode="r", iline = 189,
|
||||
f = segyio.SegyFile(fd,
|
||||
filename = str(filename),
|
||||
mode = mode,
|
||||
- iline = iline,
|
||||
- xline = xline,
|
||||
+ iline = int(iline),
|
||||
+ xline = int(xline),
|
||||
endian = endian,
|
||||
)
|
||||
|
||||
@@ -189,4 +189,4 @@ def open(filename, mode="r", iline = 189,
|
||||
if ignore_geometry:
|
||||
return f
|
||||
|
||||
- return infer_geometry(f, metrics, iline, xline, strict)
|
||||
+ return infer_geometry(f, metrics, int(iline), int(xline), strict)
|
||||
@@ -1,32 +0,0 @@
|
||||
From 6df089258c2ef4356427263f652cff0c053c6173 Mon Sep 17 00:00:00 2001
|
||||
From: Sveinung Rundhovde <ssru@equinor.com>
|
||||
Date: Fri, 26 Jul 2024 15:03:33 +0200
|
||||
Subject: [PATCH] Fix attribute error in setup.py
|
||||
|
||||
This line was causing a error due to an update to scikit-build. The
|
||||
issue was that the setuptools.command.test module is not put into the
|
||||
symbol table by the setuptools import, but it was put there during the
|
||||
skbuild import causing it to be available. Due to changes in
|
||||
scikit-build this is no longer the case and the line gives an
|
||||
AttributError.
|
||||
|
||||
The rationale for this line was that scikit-builds test command implied
|
||||
develop (this was obnoxious), something that is no longer true. There is
|
||||
thus no longer any reason to keep this line, so we can fix this issue by
|
||||
simply removing it.
|
||||
---
|
||||
python/setup.py | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/python/setup.py b/python/setup.py
|
||||
index 6c6553bc..6bae62f0 100644
|
||||
--- a/python/setup.py
|
||||
+++ b/python/setup.py
|
||||
@@ -95,7 +95,6 @@ def src(x):
|
||||
# supported OS X release 10.9
|
||||
'-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9',
|
||||
],
|
||||
- cmdclass = { 'test': setuptools.command.test.test },
|
||||
classifiers = [
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Other Environment',
|
||||
@@ -1,34 +0,0 @@
|
||||
From 75b2156a6414e2464eb15663004b8ab928374135 Mon Sep 17 00:00:00 2001
|
||||
From: Sveinung Rundhovde <ssru@equinor.com>
|
||||
Date: Tue, 30 Jul 2024 08:32:56 +0200
|
||||
Subject: [PATCH] Fix test failing due to Numpy 2.0 promotion rules
|
||||
|
||||
From Numpy 2.0 adding a numpy.float32 and a Python numeric type returns
|
||||
a numy.float32 when it previously returned a numpy.float64. This changes
|
||||
the behavior when using the Python builtin sum function on a
|
||||
numpy.float32 array as the internal computations now will be performed
|
||||
as numpy.float32 additions when it used to be numpy.float64.
|
||||
|
||||
Passing a numpy.double(0) as a start value to the innermost sum forces
|
||||
the old behavior and provides consistent results for Numpy 1 and 2.
|
||||
---
|
||||
python/test/segyio_c.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/python/test/segyio_c.py b/python/test/segyio_c.py
|
||||
index 45fe95d89..b1e144d9d 100644
|
||||
--- a/python/test/segyio_c.py
|
||||
+++ b/python/test/segyio_c.py
|
||||
@@ -540,10 +540,10 @@ def read_line(f, metrics, iline_idx, xline_idx):
|
||||
buf = numpy.zeros((len(iline_idx), samples), dtype=numpy.single)
|
||||
|
||||
f.getline(xline_trace0, len(iline_idx), xline_stride, offsets, buf)
|
||||
- assert sum(sum(buf)) == approx(800.061169624, abs=1e-6)
|
||||
+ assert sum(sum(buf), numpy.double(0)) == approx(800.061169624, abs=1e-6)
|
||||
|
||||
f.getline(iline_trace0, len(xline_idx), iline_stride, offsets, buf)
|
||||
- assert sum(sum(buf)) == approx(305.061146736, abs=1e-6)
|
||||
+ assert sum(sum(buf), numpy.double(0)) == approx(305.061146736, abs=1e-6)
|
||||
|
||||
f.close()
|
||||
|
||||
Reference in New Issue
Block a user