summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/btchip-python/default.nix
blob: 0f6da29efb8a6dc13f3f406272f3f5d6c188e257 (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  hidapi,
  pyscard,
  ecdsa,
}:

buildPythonPackage rec {
  pname = "btchip-python";
  version = "0.1.32";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-NPXgwWHAj2XcDQcLov9MMV7SHEt+D6oypGhi0Nwbj1U=";
  };

  postPatch = ''
    # fix extra_requires validation
    substituteInPlace setup.py \
      --replace "python-pyscard>=1.6.12-4build1" "python-pyscard>=1.6.12"
  '';

  propagatedBuildInputs = [
    hidapi
    ecdsa
  ];

  optional-dependencies.smartcard = [ pyscard ];

  # tests requires hardware
  doCheck = false;

  pythonImportsCheck = [ "btchip.btchip" ];

  meta = {
    description = "Python communication library for Ledger Hardware Wallet products";
    homepage = "https://github.com/LedgerHQ/btchip-python";
    license = lib.licenses.asl20;
  };
}