Skip to content

Commit

Permalink
Disable SecretService backend if org.freedesktop.secrets name is not …
Browse files Browse the repository at this point in the history
…available

Fixes jaraco#162, jaraco#434.
  • Loading branch information
mitya57 committed Nov 7, 2020
1 parent 9ba71d6 commit 3ae230d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions keyring/backends/SecretService.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ def priority(cls):
secretstorage.__name__
if exc:
raise RuntimeError("SecretStorage required")
if secretstorage.__version_tuple__[0] < 3:
raise RuntimeError("SecretStorage 3.0 or newer required")
if secretstorage.__version_tuple__ < (3, 2):
raise RuntimeError("SecretStorage 3.2 or newer required")
try:
with closing(secretstorage.dbus_init()) as connection:
list(secretstorage.get_all_collections(connection))
if not secretstorage.check_service_availability(connection):
raise RuntimeError(
"The Secret Service daemon is neither running nor "
"activatable through D-Bus"
)
except exceptions.SecretStorageException as e:
raise RuntimeError("Unable to initialize SecretService: %s" % e)
return 5
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include_package_data = true
python_requires = >=3.6
install_requires =
pywin32-ctypes!=0.1.0,!=0.1.1; sys_platform=="win32"
SecretStorage>=3; sys_platform=="linux"
SecretStorage>=3.2; sys_platform=="linux"
jeepney>=0.4.2; sys_platform=="linux"
importlib_metadata >= 1; python_version < "3.8"
setup_requires = setuptools_scm[toml] >= 3.4.1
Expand Down

0 comments on commit 3ae230d

Please sign in to comment.