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