summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/opaque/default.nix
blob: 7c9996dcf2e16a30b2ea510017dda2456f2f1aaf (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
51
52
53
{
  lib,
  stdenv,
  buildPythonPackage,
  libopaque,
  setuptools,
  pysodium,
  python,
}:

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

  inherit (libopaque)
    version
    src
    ;

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

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

  build-system = [ setuptools ];

  dependencies = [ pysodium ];

  pythonImportsCheck = [ "opaque" ];

  checkPhase = ''
    runHook preCheck

    ${python.interpreter} test/simple.py

    runHook postCheck
  '';

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