From 7346b04100453c8cc6ea5e603dc7c81994e56581 Mon Sep 17 00:00:00 2001 From: AtilaSaraiva Date: Sun, 24 Apr 2022 12:12:30 -0300 Subject: [PATCH] segyio: init at 1.9.9 --- .../python-modules/segyio/default.nix | 55 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++ 2 files changed, 59 insertions(+) create mode 100644 pkgs/development/python-modules/segyio/default.nix diff --git a/pkgs/development/python-modules/segyio/default.nix b/pkgs/development/python-modules/segyio/default.nix new file mode 100644 index 00000000000..546f1117e80 --- /dev/null +++ b/pkgs/development/python-modules/segyio/default.nix @@ -0,0 +1,55 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, ninja +, python +, scikit-build +, pytest +, numpy +, fetchpatch +}: + +stdenv.mkDerivation rec { + pname = "segyio"; + version = "1.9.9"; + + patches = [ + # PR https://github.com/equinor/segyio/pull/531 + (fetchpatch { + url = "https://github.com/equinor/segyio/commit/628bc5e02d0f98b89fe70b072df9b8e677622e9e.patch"; + sha256 = "sha256-j+vqHZNfPIh+yWBgqbGD3W04FBvFiDJKnmcC/oTk3a8="; + }) + ]; + + postPatch = '' + # Removing unecessary build dependency + substituteInPlace python/setup.py --replace "'pytest-runner'," "" + + # Fixing bug making one test fail in the python 3.10 build + substituteInPlace python/segyio/open.py --replace \ + "cube_metrics = f.xfd.cube_metrics(iline, xline)" \ + "cube_metrics = f.xfd.cube_metrics(int(iline), int(xline))" + ''; + + src = fetchFromGitHub { + owner = "equinor"; + repo = pname; + rev = version; + sha256 = "sha256-L3u5BHS5tARS2aIiQbumADkuzw1Aw4Yuav8H8tRNYNg="; + }; + + nativeBuildInputs = [ cmake ninja python scikit-build ]; + + doCheck = true; + # I'm not modifying the checkPhase nor adding a pytestCheckHook because the pytest is called + # within the cmake test phase + checkInputs = [ pytest numpy ]; + + meta = with lib; { + description = "Fast Python library for SEGY files"; + homepage = "https://github.com/equinor/segyio"; + license = licenses.lgpl3Only; + maintainers = with maintainers; [ atila ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c18f65d85f7..12071cc2a3b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9213,6 +9213,10 @@ in { segments = callPackage ../development/python-modules/segments { }; + segyio = toPythonModule (callPackage ../development/python-modules/segyio { + inherit (pkgs) cmake ninja; + }); + selectors2 = callPackage ../development/python-modules/selectors2 { }; selenium = callPackage ../development/python-modules/selenium { };