1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 equihash,
6 setuptools,
7 python,
8}:
9
10buildPythonPackage rec {
11 pname = "pyequihash";
12 pyproject = true;
13
14 inherit (equihash)
15 version
16 src
17 ;
18
19 sourceRoot = "${src.name}/python";
20
21 postPatch =
22 let
23 soext = stdenv.hostPlatform.extensions.sharedLibrary;
24 in
25 ''
26 substituteInPlace ./equihash/__init__.py --replace-fail \
27 "ctypes.util.find_library('equihash') or ctypes.util.find_library('libequihash')" "'${lib.getLib equihash}/lib/libequihash${soext}'"
28 '';
29
30 build-system = [ setuptools ];
31
32 pythonImportsCheck = [ "equihash" ];
33
34 checkPhase = ''
35 runHook preCheck
36
37 ${python.interpreter} test.py
38
39 runHook postCheck
40 '';
41
42 meta = {
43 inherit (equihash.meta)
44 description
45 homepage
46 license
47 teams
48 ;
49 };
50}