about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pyu2f/default.nix
blob: ef09f1285183d9e74762b695aa671a867ead9fc4 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ lib
, buildPythonPackage
, fetchFromGitHub
, six
, mock
, pyfakefs
, pytest-forked
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "pyu2f";
  version = "0.1.5a";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "google";
    repo = pname;
    rev = "refs/tags/${version}";
    sha256 = "0mx7bn1p3n0fxyxa82wg3c719hby7vqkxv57fhf7zvhlg2zfnr0v";
  };

  propagatedBuildInputs = [
    six
  ];

  postPatch = ''
    for path in \
      customauthenticator_test.py \
      hardware_test.py \
      hidtransport_test.py \
      localauthenticator_test.py \
      model_test.py \
      u2f_test.py \
      util_test.py \
      hid/macos_test.py; \
    do
      # https://docs.python.org/3/whatsnew/3.12.html#id3
      substituteInPlace pyu2f/tests/$path \
        --replace "assertEquals" "assertEqual" \
        --replace "assertRaisesRegexp" "assertRaisesRegex"
    done
  '';

  nativeCheckInputs = [
    mock
    pyfakefs
    pytest-forked
    pytestCheckHook
  ];

  disabledTestPaths = [
    # API breakage with pyfakefs>=5.0
    "pyu2f/tests/hid/linux_test.py"
  ];

  meta = with lib; {
    description = "U2F host library for interacting with a U2F device over USB";
    homepage = "https://github.com/google/pyu2f";
    license = licenses.asl20;
    maintainers = with maintainers; [ prusnak ];
  };
}