1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 mock,
6 nose,
7 pexpect,
8 pyserial,
9 pytestCheckHook,
10 pythonOlder,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "pygatt";
16 version = "4.0.5";
17 pyproject = true;
18
19 disabled = pythonOlder "3.5";
20
21 src = fetchFromGitHub {
22 owner = "peplin";
23 repo = "pygatt";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-DUZGsztZViVNZwmhXoRN5FOQ7BgUeI0SsYgCHlvsrv0=";
26 };
27
28 postPatch = ''
29 # Not support for Python < 3.4
30 substituteInPlace setup.py \
31 --replace-fail "'enum-compat'" "" \
32 --replace-fail "'coverage >= 3.7.1'," "" \
33 --replace-fail "'nose >= 1.3.7'" ""
34 substituteInPlace tests/bgapi/test_bgapi.py \
35 --replace-fail "assertEquals" "assertEqual"
36 '';
37
38 build-system = [ setuptools ];
39
40 dependencies = [ pyserial ];
41
42 optional-dependencies.GATTTOOL = [ pexpect ];
43
44 # tests require nose
45 doCheck = pythonOlder "3.12";
46
47 nativeCheckInputs = [
48 mock
49 nose
50 pytestCheckHook
51 ] ++ optional-dependencies.GATTTOOL;
52
53 pythonImportsCheck = [ "pygatt" ];
54
55 meta = with lib; {
56 description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
57 homepage = "https://github.com/peplin/pygatt";
58 changelog = "https://github.com/peplin/pygatt/blob/v${version}/CHANGELOG.rst";
59 license = with licenses; [
60 asl20
61 mit
62 ];
63 maintainers = with maintainers; [ fab ];
64 };
65}