1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7 installShellFiles,
8 setuptools,
9 setuptools-scm,
10 shtab,
11 importlib-metadata,
12 jaraco-classes,
13 jaraco-context,
14 jaraco-functools,
15 jeepney,
16 secretstorage,
17 pytestCheckHook,
18}:
19
20buildPythonPackage rec {
21 pname = "keyring_24";
22 # nixpkgs-update: no auto update
23 version = "24.3.1";
24 pyproject = true;
25 disabled = pythonOlder "3.8";
26
27 src = fetchPypi {
28 inherit version;
29 pname = "keyring";
30 hash = "sha256-wzJ7b/r8DovvvbWXys20ko/+XBIS92RfGG5tmVeomNs=";
31 };
32
33 nativeBuildInputs = [
34 installShellFiles
35 shtab
36 ];
37
38 build-system = [
39 setuptools
40 setuptools-scm
41 ];
42
43 dependencies =
44 [
45 jaraco-classes
46 jaraco-context
47 jaraco-functools
48 ]
49 ++ lib.optionals stdenv.isLinux [
50 jeepney
51 secretstorage
52 ]
53 ++ lib.optionals (pythonOlder "3.12") [ importlib-metadata ];
54
55 postInstall = ''
56 installShellCompletion --cmd keyring \
57 --bash <($out/bin/keyring --print-completion bash) \
58 --zsh <($out/bin/keyring --print-completion zsh)
59 '';
60
61 pythonImportsCheck = [
62 "keyring"
63 "keyring.backend"
64 ];
65
66 nativeCheckInputs = [ pytestCheckHook ];
67
68 disabledTestPaths =
69 [ "tests/backends/test_macOS.py" ]
70 # These tests fail when sandboxing is enabled because they are unable to get a password from keychain.
71 ++ lib.optional stdenv.isDarwin "tests/test_multiprocess.py";
72
73 meta = with lib; {
74 description = "Store and access your passwords safely";
75 homepage = "https://github.com/jaraco/keyring";
76 changelog = "https://github.com/jaraco/keyring/blob/v${version}/NEWS.rst";
77 license = licenses.mit;
78 mainProgram = "keyring";
79 maintainers = with maintainers; [ jnsgruk ];
80 };
81}