summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyequihash/default.nix
blob: 54b033d2b89e3b0cc0d91ffe99e04fac5d9064d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
  lib,
  stdenv,
  buildPythonPackage,
  equihash,
  setuptools,
  python,
}:

buildPythonPackage rec {
  pname = "pyequihash";
  pyproject = true;

  inherit (equihash)
    version
    src
    ;

  sourceRoot = "${src.name}/python";

  postPatch =
    let
      soext = stdenv.hostPlatform.extensions.sharedLibrary;
    in
    ''
      substituteInPlace ./equihash/__init__.py --replace-fail \
        "ctypes.util.find_library('equihash') or ctypes.util.find_library('libequihash')" "'${lib.getLib equihash}/lib/libequihash${soext}'"
    '';

  build-system = [ setuptools ];

  pythonImportsCheck = [ "equihash" ];

  checkPhase = ''
    runHook preCheck

    ${python.interpreter} test.py

    runHook postCheck
  '';

  meta = {
    inherit (equihash.meta)
      description
      homepage
      license
      teams
      ;
  };
}