1{ lib
2, buildPythonPackage
3, fetchpatch
4, fetchFromGitHub
5, cython
6, cmake
7, symengine
8, pytest
9, sympy
10, python
11}:
12
13buildPythonPackage rec {
14 pname = "symengine";
15 version = "0.9.2";
16 format = "setuptools";
17
18 src = fetchFromGitHub {
19 owner = "symengine";
20 repo = "symengine.py";
21 rev = "v${version}";
22 sha256 = "sha256-ZHplYEG97foy/unOdSokFFkDl4LK5TI4kypHSLpcCM4=";
23 };
24
25 patches = [
26 (fetchpatch {
27 # setuptools 61 compat
28 url = "https://github.com/symengine/symengine.py/commit/987e665e71cf92d1b021d7d573a1b9733408eecf.patch";
29 hash = "sha256-2QbNdw/lKYRIRpOU5BiwF2kK+5Lh2j/Q82MKUIvl0+c=";
30 })
31 ];
32
33 postPatch = ''
34 substituteInPlace setup.py \
35 --replace "\"cmake\"" "\"${cmake}/bin/cmake\"" \
36 --replace "'cython>=0.29.24'" "'cython'"
37 '';
38
39 nativeBuildUnputs = [ cmake ];
40
41 buildInputs = [ cython ];
42
43 checkInputs = [ pytest sympy ];
44
45 setupPyBuildFlags = [
46 "--symengine-dir=${symengine}/"
47 "--define=\"CYTHON_BIN=${cython}/bin/cython\""
48 ];
49
50 checkPhase = ''
51 mkdir empty
52 cd empty
53 ${python.interpreter} ../bin/test_python.py
54 '';
55
56 meta = with lib; {
57 description = "Python library providing wrappers to SymEngine";
58 homepage = "https://github.com/symengine/symengine.py";
59 license = licenses.mit;
60 maintainers = [ maintainers.costrouc ];
61 };
62}