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