1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cmake,
6 ninja,
7 scikit-build,
8 pytest,
9 numpy,
10}:
11
12buildPythonPackage rec {
13 pname = "segyio";
14 version = "1.9.13";
15 pyproject = false; # Built with cmake
16
17 patches = [
18 # https://github.com/equinor/segyio/pull/570
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
24 ];
25
26 postPatch = ''
27 # Removing unecessary build dependency
28 substituteInPlace python/setup.py --replace "'pytest-runner'," ""
29
30 # Fixing bug making one test fail in the python 3.10 build
31 substituteInPlace python/segyio/open.py --replace \
32 "cube_metrics = f.xfd.cube_metrics(iline, xline)" \
33 "cube_metrics = f.xfd.cube_metrics(int(iline), int(xline))"
34 '';
35
36 src = fetchFromGitHub {
37 owner = "equinor";
38 repo = "segyio";
39 tag = "v${version}";
40 hash = "sha256-uVQ5cs9EPGUTSbaclLjFDwnbJevtv6ie94FLi+9vd94=";
41 };
42
43 nativeBuildInputs = [
44 cmake
45 ninja
46 scikit-build
47 ];
48
49 # I'm not modifying the checkPhase nor adding a pytestCheckHook because the pytest is called
50 # within the cmake test phase
51 nativeCheckInputs = [
52 pytest
53 numpy
54 ];
55
56 meta = {
57 description = "Fast Python library for SEGY files";
58 homepage = "https://github.com/equinor/segyio";
59 license = lib.licenses.lgpl3Only;
60 maintainers = with lib.maintainers; [ atila ];
61 };
62}