1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 six,
6 mock,
7 pyfakefs,
8 pytest-forked,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "pyu2f";
14 version = "0.1.5a";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "google";
19 repo = "pyu2f";
20 tag = version;
21 sha256 = "0mx7bn1p3n0fxyxa82wg3c719hby7vqkxv57fhf7zvhlg2zfnr0v";
22 };
23
24 propagatedBuildInputs = [ six ];
25
26 postPatch = ''
27 for path in \
28 customauthenticator_test.py \
29 hardware_test.py \
30 hidtransport_test.py \
31 localauthenticator_test.py \
32 model_test.py \
33 u2f_test.py \
34 util_test.py \
35 hid/macos_test.py; \
36 do
37 # https://docs.python.org/3/whatsnew/3.12.html#id3
38 substituteInPlace pyu2f/tests/$path \
39 --replace "assertEquals" "assertEqual" \
40 --replace "assertRaisesRegexp" "assertRaisesRegex"
41 done
42 '';
43
44 nativeCheckInputs = [
45 mock
46 pyfakefs
47 pytest-forked
48 pytestCheckHook
49 ];
50
51 disabledTestPaths = [
52 # API breakage with pyfakefs>=5.0
53 "pyu2f/tests/hid/linux_test.py"
54 ];
55
56 meta = with lib; {
57 description = "U2F host library for interacting with a U2F device over USB";
58 homepage = "https://github.com/google/pyu2f";
59 license = licenses.asl20;
60 maintainers = with maintainers; [ prusnak ];
61 };
62}