about summary refs log tree commit diff
path: root/pkgs/development/python-modules/hid/default.nix
blob: 7c33cb5b9d3c5b099637514979ae11466e23fe39 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchPypi
, setuptools
, hidapi
}:

buildPythonPackage rec {
  pname = "hid";
  version = "1.0.6";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-SNdk166XRroSO5bb9FeJPKgCaLd5HEsdLgUTEO64OGA=";
  };

 postPatch = ''
   hidapi=${hidapi}/lib/
   test -d $hidapi || { echo "ERROR: $hidapi doesn't exist, please update/fix this build expression."; exit 1; }
   sed -i -e "s|libhidapi|$hidapi/libhidapi|" hid/__init__.py
  '';

  build-system = [
    setuptools
  ];

  dependencies = [
    hidapi
  ];

  doCheck = false; # no tests

  pythonImportsCheck = [
    "hid"
  ];

  meta = with lib; {
    description = "hidapi bindings in ctypes";
    homepage = "https://github.com/apmorton/pyhidapi";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ AndersonTorres ];
  };
}