nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 ninja,
8 scikit-build,
9 pytest,
10 numpy,
11}:
12
13buildPythonPackage rec {
14 pname = "segyio";
15 version = "1.9.14";
16 pyproject = false; # Built with cmake
17
18 patches = [
19 # Bump minimum CMake version to 3.11
20 (fetchpatch {
21 url = "https://github.com/equinor/segyio/commit/3e2cbe6ca6d4bc7d4f4d95666f5d2983836e8461.patch?full_index=1";
22 hash = "sha256-sOBHi8meMSkxEZy0AXwebAnIVPatpwQHd+4Co5zIhLQ=";
23 })
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-Gprxxz4wUDrThCghW1Z1dHTjeJCrcDxuwguVC+i+ydc=";
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 = [ ];
61 };
62}