1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, mock
5, nose
6, pexpect
7, pyserial
8, pytestCheckHook
9, pythonOlder
10}:
11
12buildPythonPackage rec {
13 pname = "pygatt";
14 version = "4.0.5";
15 disabled = pythonOlder "3.5";
16
17 src = fetchFromGitHub {
18 owner = "peplin";
19 repo = pname;
20 rev = "v${version}";
21 sha256 = "1zdfxidiw0l8n498sy0l33n90lz49n25x889cx6jamjr7frlcihd";
22 };
23
24 propagatedBuildInputs = [
25 pyserial
26 ];
27
28 passthru.optional-dependencies.GATTTOOL = [
29 pexpect
30 ];
31
32 nativeBuildInputs = [
33 # For cross compilation the doCheck is false and therefor the
34 # nativeCheckInputs not included. We have to include nose here, since
35 # setup.py requires nose unconditionally.
36 nose
37 ];
38
39 nativeCheckInputs = [
40 mock
41 pytestCheckHook
42 ]
43 ++ passthru.optional-dependencies.GATTTOOL;
44
45 postPatch = ''
46 # Not support for Python < 3.4
47 substituteInPlace setup.py --replace "'enum-compat'" ""
48 '';
49
50 pythonImportsCheck = [ "pygatt" ];
51
52 meta = with lib; {
53 description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
54 homepage = "https://github.com/peplin/pygatt";
55 license = with licenses; [ asl20 mit ];
56 maintainers = with maintainers; [ fab ];
57 };
58}