1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 mock,
6 pexpect,
7 pyserial,
8 pytestCheckHook,
9 pythonOlder,
10 setuptools,
11}:
12
13buildPythonPackage rec {
14 pname = "pygatt";
15 version = "5.0.0";
16 pyproject = true;
17
18 disabled = pythonOlder "3.10";
19
20 src = fetchFromGitHub {
21 owner = "peplin";
22 repo = "pygatt";
23 tag = "v${version}";
24 hash = "sha256-TMIqC+JvNOLU38a9jkacRAbdmAAd4UekFUDRoAWhHFo=";
25 };
26
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace-fail "setup_requires" "test_requires"
30 '';
31
32 pythonRemoveDeps = [ "enum-compat" ];
33
34 build-system = [ setuptools ];
35
36 dependencies = [ pyserial ];
37
38 optional-dependencies.GATTTOOL = [ pexpect ];
39
40 nativeCheckInputs = [
41 mock
42 pytestCheckHook
43 ]
44 ++ optional-dependencies.GATTTOOL;
45
46 pythonImportsCheck = [ "pygatt" ];
47
48 meta = with lib; {
49 description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
50 homepage = "https://github.com/peplin/pygatt";
51 changelog = "https://github.com/peplin/pygatt/blob/v${version}/CHANGELOG.rst";
52 license = with licenses; [
53 asl20
54 mit
55 ];
56 maintainers = with maintainers; [ fab ];
57 };
58}