nixpkgs/pkgs/development/python-modules/pygsl/default.nix
2024-08-04 22:08:46 +02:00

54 lines
1.2 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
gsl,
swig,
numpy,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "pygsl";
version = "2.4.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "pygsl";
repo = "pygsl";
rev = "refs/tags/v${version}";
hash = "sha256-7agGgfDUgY6mRry7d38vGGNLJC4dFUniy2M/cnejDDs=";
};
# error: no member named 'n' in 'gsl_bspline_workspace'
postPatch = lib.optionalString (lib.versionAtLeast gsl.version "2.8") ''
substituteInPlace src/bspline/bspline.ic \
--replace-fail "self->w->n" "self->w->ncontrol"
substituteInPlace swig_src/bspline_wrap.c \
--replace-fail "self->w->n;" "self->w->ncontrol;"
'';
nativeBuildInputs = [
gsl.dev
swig
];
buildInputs = [ gsl ];
dependencies = [ numpy ];
preBuild = ''
python setup.py build_ext --inplace
'';
preCheck = ''
cd tests
'';
nativeCheckInputs = [ pytestCheckHook ];
meta = {
description = "Python interface for GNU Scientific Library";
homepage = "https://github.com/pygsl/pygsl";
changelog = "https://github.com/pygsl/pygsl/blob/v${version}/ChangeLog";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ amesgen ];
};
}