1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, ninja
6, python
7, scikit-build
8, pytest
9, numpy
10, fetchpatch
11}:
12
13stdenv.mkDerivation rec {
14 pname = "segyio";
15 version = "1.9.9";
16
17 patches = [
18 # PR https://github.com/equinor/segyio/pull/531
19 (fetchpatch {
20 url = "https://github.com/equinor/segyio/commit/628bc5e02d0f98b89fe70b072df9b8e677622e9e.patch";
21 sha256 = "sha256-j+vqHZNfPIh+yWBgqbGD3W04FBvFiDJKnmcC/oTk3a8=";
22 })
23 ];
24
25 postPatch = ''
26 # Removing unecessary build dependency
27 substituteInPlace python/setup.py --replace "'pytest-runner'," ""
28
29 # Fixing bug making one test fail in the python 3.10 build
30 substituteInPlace python/segyio/open.py --replace \
31 "cube_metrics = f.xfd.cube_metrics(iline, xline)" \
32 "cube_metrics = f.xfd.cube_metrics(int(iline), int(xline))"
33 '';
34
35 src = fetchFromGitHub {
36 owner = "equinor";
37 repo = pname;
38 rev = version;
39 sha256 = "sha256-L3u5BHS5tARS2aIiQbumADkuzw1Aw4Yuav8H8tRNYNg=";
40 };
41
42 nativeBuildInputs = [ cmake ninja python scikit-build ];
43
44 doCheck = true;
45 # I'm not modifying the checkPhase nor adding a pytestCheckHook because the pytest is called
46 # within the cmake test phase
47 checkInputs = [ pytest numpy ];
48
49 meta = with lib; {
50 description = "Fast Python library for SEGY files";
51 homepage = "https://github.com/equinor/segyio";
52 license = licenses.lgpl3Only;
53 maintainers = with maintainers; [ atila ];
54 };
55}