1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 substituteAll,
6
7 # build
8 pkg-config,
9 glibc,
10 python,
11
12 # runtime
13 bluez,
14 boost,
15 glib,
16
17}:
18
19let
20 pname = "gattlib";
21 version = "unstable-2021-06-16";
22in
23buildPythonPackage {
24 inherit pname version;
25 format = "setuptools";
26
27 src = fetchFromGitHub {
28 owner = "oscaracena";
29 repo = "pygattlib";
30 rev = "7bdb229124fe7d9f4a2cc090277b0fdef82e2a56";
31 hash = "sha256-PS5DIH1JuH2HweyebLLM+UNFGY/XsjKIrsD9x7g7yMI=";
32 };
33
34 patches = [
35 (substituteAll {
36 src = ./setup.patch;
37 boost_version =
38 let
39 pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
40 in
41 "boost_python${pythonVersion}";
42 })
43 ];
44
45 nativeBuildInputs = [
46 pkg-config
47 glibc
48 ];
49
50 buildInputs = [
51 bluez
52 boost
53 glib
54 ];
55
56 # has no tests
57 doCheck = false;
58
59 pythonImportsCheck = [ "gattlib" ];
60
61 meta = with lib; {
62 description = "Python library to use the GATT Protocol for Bluetooth LE devices";
63 homepage = "https://github.com/oscaracena/pygattlib";
64 license = licenses.asl20;
65 maintainers = with maintainers; [ hexa ];
66 };
67}