1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 mock,
6 pynose,
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 passthru.optional-dependencies.GATTTOOL = [ pexpect ];
43
44 nativeBuildInputs = [
45 # For cross compilation the doCheck is false and therefor the
46 # nativeCheckInputs not included. We have to include nose here, since
47 # setup.py requires nose unconditionally.
48 pynose
49 ];
50
51 nativeCheckInputs = [
52 mock
53 pytestCheckHook
54 ] ++ passthru.optional-dependencies.GATTTOOL;
55
56 pythonImportsCheck = [ "pygatt" ];
57
58 meta = with lib; {
59 description = "Python wrapper the BGAPI for accessing Bluetooth LE Devices";
60 homepage = "https://github.com/peplin/pygatt";
61 changelog = "https://github.com/peplin/pygatt/blob/v${version}/CHANGELOG.rst";
62 license = with licenses; [
63 asl20
64 mit
65 ];
66 maintainers = with maintainers; [ fab ];
67 };
68}