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