summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pygatt/default.nix
blob: 1d4a7a38dfa3ef956e63a31b9e0a2b4a83a67d79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  mock,
  pexpect,
  pyserial,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pygatt";
  version = "5.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "peplin";
    repo = "pygatt";
    tag = "v${version}";
    hash = "sha256-TMIqC+JvNOLU38a9jkacRAbdmAAd4UekFUDRoAWhHFo=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "setup_requires" "test_requires"
  '';

  pythonRemoveDeps = [ "enum-compat" ];

  build-system = [ setuptools ];

  dependencies = [ pyserial ];

  optional-dependencies.GATTTOOL = [ pexpect ];

  nativeCheckInputs = [
    mock
    pytestCheckHook
  ]
  ++ optional-dependencies.GATTTOOL;

  pythonImportsCheck = [ "pygatt" ];

  meta = {
    description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
    homepage = "https://github.com/peplin/pygatt";
    changelog = "https://github.com/peplin/pygatt/blob/v${version}/CHANGELOG.rst";
    license = with lib.licenses; [
      asl20
      mit
    ];
    maintainers = with lib.maintainers; [ fab ];
  };
}