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