summary refs log tree commit diff
path: root/pkgs/development/python-modules/pygatt/default.nix
blob: fab5c093c50289633a1b7cde83ed705f4881b415 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, mock
, nose
, pexpect
, pyserial
, pytestCheckHook
, pythonOlder
}:

buildPythonPackage rec {
  pname = "pygatt";
  version = "4.0.5";
  disabled = pythonOlder "3.5";

  src = fetchFromGitHub {
    owner = "peplin";
    repo = pname;
    rev = "v${version}";
    sha256 = "1zdfxidiw0l8n498sy0l33n90lz49n25x889cx6jamjr7frlcihd";
  };

  propagatedBuildInputs = [
    pyserial
  ];

  passthru.optional-dependencies.GATTTOOL = [
    pexpect
  ];

  checkInputs = [
    mock
    nose
    pytestCheckHook
  ]
  ++ passthru.optional-dependencies.GATTTOOL;

  postPatch = ''
    # Not support for Python < 3.4
    substituteInPlace setup.py --replace "'enum-compat'" ""
  '';

  pythonImportsCheck = [ "pygatt" ];

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