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