about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/btchip-python/default.nix
blob: 901a3b2cc9545fa2e12a30a4d94c089d998943e3 (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
45
46
{ 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
  ];

  passthru.optional-dependencies.smartcard = [
    pyscard
  ];

  # tests requires hardware
  doCheck = false;

  pythonImportsCheck = [
    "btchip.btchip"
  ];

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