1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 setuptools,
7 pyusb,
8 influxdb-client,
9 pyserial,
10 pytestCheckHook,
11 udevCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "openant-unstable";
16 version = "1.3.1";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "Tigge";
23 repo = "openant";
24 tag = "v${version}";
25 hash = "sha256-wDtHlkVyD7mMDXZ4LGMgatr9sSlQKVbgkYsKvHGr9Pc=";
26 };
27
28 nativeBuildInputs = [
29 setuptools
30 udevCheckHook
31 ];
32
33 postInstall = ''
34 install -dm755 "$out/etc/udev/rules.d"
35 install -m644 resources/42-ant-usb-sticks.rules "$out/etc/udev/rules.d/99-ant-usb-sticks.rules"
36 '';
37
38 propagatedBuildInputs = [ pyusb ];
39
40 optional-dependencies = {
41 serial = [ pyserial ];
42 influx = [ influxdb-client ];
43 };
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 pythonImportsCheck = [ "openant" ];
48
49 meta = with lib; {
50 homepage = "https://github.com/Tigge/openant";
51 description = "ANT and ANT-FS Python Library";
52 mainProgram = "openant";
53 license = licenses.mit;
54 };
55}