Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / blspy / default.nix
blob929f1c90b7ce74bd3e81bb6ca79459d7b1e0294e
1 { lib
2 , buildPythonPackage
3 , fetchPypi
4 , fetchFromGitHub
5 , setuptools-scm
6 , substituteAll
7 , cmake
8 , boost
9 , gmp
10 , pybind11
11 , pythonOlder
14 buildPythonPackage rec {
15   pname = "blspy";
16   version = "1.0.16";
17   disabled = pythonOlder "3.7";
19   src = fetchPypi {
20     inherit pname version;
21     hash = "sha256-XABdS6CCUJpZ9N1Vra078V0HoDU32u1l3yz96ZKHwFc=";
22   };
24   patches = [
25     # prevent CMake from trying to get libraries on the Internet
26     (substituteAll {
27       src = ./dont_fetch_dependencies.patch;
28       pybind11_src = pybind11.src;
29       relic_src = fetchFromGitHub {
30         owner = "Chia-Network";
31         repo = "relic";
32         rev = "215c69966cb78b255995f0ee9c86bbbb41c3c42b"; # pinned by blspy
33         hash = "sha256-wivK18Cp7BMZJvrYxJgSHInRZgFgsgSzd0YIy5IWoYA=";
34       };
35       sodium_src = fetchFromGitHub {
36         owner = "AmineKhaldi";
37         repo = "libsodium-cmake";
38         rev = "f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65"; # pinned by blspy
39         hash = "sha256-lGz7o6DQVAuEc7yTp8bYS2kwjzHwGaNjugDi1ruRJOA=";
40         fetchSubmodules = true;
41       };
42       catch2_src = fetchFromGitHub {
43         owner = "catchorg";
44         repo = "Catch2";
45         rev = "v3.0.0-preview5"; # pinned by blspy
46         hash = "sha256-IQ1yGZo3nKHTqScUoq3i3Njxqvk7uW8hQ3GT0/SxGaw=";
47       };
48     })
49   ];
51   # ImportError: cannot import name 'setuptools' from 'setuptools'
52   # this is resolved in the next release, v2
53   postPatch = ''
54     substituteInPlace setup.py \
55       --replace "from setuptools import Extension, setup, setuptools" "from setuptools import Extension, setup"
56   '';
58   nativeBuildInputs = [ cmake setuptools-scm ];
60   buildInputs = [ boost gmp.static pybind11 ];
62   pythonImportsCheck = [
63     "blspy"
64   ];
66   # Note: upstream testsuite is just a single test.py script outside of any framework
67   doCheck = false;
69   # CMake needs to be run by setuptools rather than by its hook
70   dontConfigure = true;
72   meta = with lib; {
73     description = "BLS signatures with aggregation";
74     homepage = "https://github.com/Chia-Network/bls-signatures/";
75     license = licenses.asl20;
76     maintainers = teams.chia.members;
77   };