1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 gsl,
6 swig,
7 numpy,
8 pytestCheckHook,
9}:
10
11buildPythonPackage rec {
12 pname = "pygsl";
13 version = "2.5.0";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "pygsl";
18 repo = "pygsl";
19 tag = "v${version}";
20 hash = "sha256-ym7wCCaqY1y4Q7LDaNfGoao//DcG+H/6Fmg0YZUThOU=";
21 };
22
23 # error: no member named 'n' in 'gsl_bspline_workspace'
24 postPatch = lib.optionalString (lib.versionAtLeast gsl.version "2.8") ''
25 substituteInPlace src/bspline/bspline.ic \
26 --replace-fail "self->w->n" "self->w->ncontrol"
27 substituteInPlace swig_src/bspline_wrap.c \
28 --replace-fail "self->w->n;" "self->w->ncontrol;"
29 '';
30
31 nativeBuildInputs = [
32 gsl.dev
33 swig
34 ];
35 buildInputs = [ gsl ];
36 dependencies = [ numpy ];
37
38 preBuild = ''
39 python setup.py build_ext --inplace
40 '';
41
42 preCheck = ''
43 cd tests
44 '';
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 meta = {
48 description = "Python interface for GNU Scientific Library";
49 homepage = "https://github.com/pygsl/pygsl";
50 changelog = "https://github.com/pygsl/pygsl/blob/v${version}/ChangeLog";
51 license = lib.licenses.gpl2Plus;
52 maintainers = with lib.maintainers; [ amesgen ];
53 };
54}