1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 asn1crypto,
6 autoconf,
7 automake,
8 cffi,
9 libtool,
10 pkg-config,
11 pytestCheckHook,
12 python,
13 pythonOlder,
14 secp256k1,
15}:
16
17buildPythonPackage rec {
18 pname = "coincurve";
19 version = "19.0.1";
20 format = "setuptools";
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "ofek";
25 repo = "coincurve";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-T60iKRrc8/t86nqf8/R4971SjOw586YNCWWBuLd9MjM=";
28 };
29
30 postPatch = ''
31 substituteInPlace setup.py \
32 --replace ", 'requests'" ""
33
34 # don't try to load .dll files
35 rm coincurve/_windows_libsecp256k1.py
36 cp -r --no-preserve=mode ${secp256k1.src} libsecp256k1
37 patchShebangs secp256k1/autogen.sh
38 '';
39
40 nativeBuildInputs = [
41 autoconf
42 automake
43 libtool
44 pkg-config
45 ];
46
47 propagatedBuildInputs = [
48 asn1crypto
49 cffi
50 ];
51
52 preCheck = ''
53 # https://github.com/ofek/coincurve/blob/master/tox.ini#L20-L22=
54 rm -rf coincurve
55
56 # don't run benchmark tests
57 rm tests/test_bench.py
58 '';
59
60 nativeCheckInputs = [ pytestCheckHook ];
61
62 pythonImportsCheck = [ "coincurve" ];
63
64 meta = with lib; {
65 description = "Cross-platform bindings for libsecp256k1";
66 homepage = "https://github.com/ofek/coincurve";
67 license = with licenses; [
68 asl20
69 mit
70 ];
71 maintainers = with maintainers; [ ];
72 };
73}