1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 replaceVars,
7
8 # build
9 pkg-config,
10 glibc,
11 python,
12 setuptools,
13 bluez,
14 boost,
15 glib,
16}:
17
18buildPythonPackage rec {
19 pname = "gattlib";
20 version = "20210616";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "oscaracena";
25 repo = "pygattlib";
26 rev = "v.${version}";
27 hash = "sha256-n3D9CWKvgw4FYmbvsfhaHN963HARBG0p4CcZBC8Gkb0=";
28 };
29
30 patches = [
31 # Fix build for Python 3.13
32 (fetchpatch {
33 url = "https://github.com/oscaracena/pygattlib/commit/73a73b71cfc139e1e0a08816fb976ff330c77ea5.patch";
34 hash = "sha256-/Y/CZNdN/jcxWroqRfdCH2rPUxZUbug668MIAow0scs=";
35 })
36 (replaceVars ./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 build-system = [ setuptools ];
46
47 nativeBuildInputs = [
48 pkg-config
49 glibc
50 ];
51
52 buildInputs = [
53 bluez
54 boost
55 glib
56 ];
57
58 # has no tests
59 doCheck = false;
60
61 pythonImportsCheck = [ "gattlib" ];
62
63 meta = with lib; {
64 description = "Python library to use the GATT Protocol for Bluetooth LE devices";
65 homepage = "https://github.com/oscaracena/pygattlib";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ hexa ];
68 };
69}