summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/gattlib/default.nix
blob: 82aa2b4e3df844ac3dbe039fa60404c53b194f1e (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  replaceVars,

  # build
  pkg-config,
  glibc,
  python,
  setuptools,
  bluez,
  boost,
  glib,
}:

buildPythonPackage rec {
  pname = "gattlib";
  version = "20210616";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "oscaracena";
    repo = "pygattlib";
    rev = "v.${version}";
    hash = "sha256-n3D9CWKvgw4FYmbvsfhaHN963HARBG0p4CcZBC8Gkb0=";
  };

  patches = [
    # Fix build for Python 3.13
    (fetchpatch {
      url = "https://github.com/oscaracena/pygattlib/commit/73a73b71cfc139e1e0a08816fb976ff330c77ea5.patch";
      hash = "sha256-/Y/CZNdN/jcxWroqRfdCH2rPUxZUbug668MIAow0scs=";
    })
    (replaceVars ./setup.patch {
      boost_version =
        let
          pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
        in
        "boost_python${pythonVersion}";
    })
  ];

  build-system = [ setuptools ];

  nativeBuildInputs = [
    pkg-config
    glibc
  ];

  buildInputs = [
    bluez
    boost
    glib
  ];

  # has no tests
  doCheck = false;

  pythonImportsCheck = [ "gattlib" ];

  meta = {
    description = "Python library to use the GATT Protocol for Bluetooth LE devices";
    homepage = "https://github.com/oscaracena/pygattlib";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ hexa ];
  };
}