1{ lib
2, buildPythonPackage
3, fetchPypi
4, pkg-config
5, pytest
6, pytest-runner
7, cffi
8, secp256k1
9}:
10
11buildPythonPackage rec {
12 pname = "secp256k1";
13 version = "0.13.2";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "a3b43e02d321c09eafa769a6fc2c156f555cab3a7db62175ef2fd21e16cdf20c";
18 };
19
20 nativeBuildInputs = [ pkg-config ];
21 checkInputs = [ pytest pytest-runner ];
22 propagatedBuildInputs = [ cffi secp256k1 ];
23
24 # Tests are not included in archive
25 doCheck = false;
26
27 preConfigure = ''
28 cp -r ${secp256k1.src} libsecp256k1
29 touch libsecp256k1/autogen.sh
30 export INCLUDE_DIR=${secp256k1}/include
31 export LIB_DIR=${secp256k1}/lib
32 '';
33
34 checkPhase = ''
35 py.test tests
36 '';
37
38 postPatch = ''
39 sed -i '38,45d' setup.py
40 substituteInPlace setup.py --replace ", 'pytest-runner==2.6.2'" ""
41 '';
42
43 meta = {
44 homepage = "https://github.com/ludbb/secp256k1-py";
45 description = "Python FFI bindings for secp256k1";
46 license = with lib.licenses; [ mit ];
47 maintainers = with lib.maintainers; [ ];
48 };
49}