- Update to 23.0.1:

* #504: Better error with invalid parameter to init_keyring.
  * #505: Nicer documentation for headless Docker.
  * Backends now all invoke ``set_properties_from_env`` on
    self in the initializer. Derived backends should be sure
    to invoke ``super().__init__()``.
  * Use new entry points API from importlib_metadata 3.6.
  * Added redundant type declarations for accessor functions
    in ``keyring.core``.
  * Added type declaration for ``keyring.core.get_keyring()``.
  * #438: For better interoperability with other
    applications, ``Windows`` backend now attempts to
    decode passwords using UTF-8 if UTF-16 decoding fails.
    Passwords are still stored as UTF-16.
  * #437: Package now declares typing support.
  * #403: Keyring no longer eagerly initializes the backend
    on import, but instead defers the backend initialization
    until a keyring is accessed. Any callers reliant on this
    early intialization behavior may need to call
    ``keyring.core.init_backend()`` to explicitly initialize
    the detected backend.
  * #474: SecretService and KWallet backends are now
    disabled if the relevant names are not available on
    D-Bus. Keyring should now be much more responsive
    in these environments.
  * #463: Fixed regression in KWallet ``get_credential``
    where a simple string was returned instead of a
    SimpleCredential.
  * #431: KWallet backend now supports ``get_credential``.
  * #445: Suppress errors when ``sys.argv`` is not

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-keyring?expand=0&rev=90
This commit is contained in:
Matej Cepl 2021-06-17 15:03:11 +00:00 committed by Git OBS Bridge
parent 0bbe6cf4b1
commit 7becd474d0
5 changed files with 50 additions and 104 deletions

View File

@ -1,95 +0,0 @@
diff --git a/tests/backends/test_kwallet.py b/tests/backends/test_kwallet.py
index 68cb4c7..f2d1638 100644
--- a/tests/backends/test_kwallet.py
+++ b/tests/backends/test_kwallet.py
@@ -6,6 +6,7 @@ from keyring.testing.backend import BackendBasicTests
@pytest.mark.skipif(not kwallet.DBusKeyring.viable, reason="KWallet5 unavailable")
class TestDBusKWallet(BackendBasicTests):
+ __test__ = True
# Remove '@' from service name as this is not supported in service names
# '@' will cause troubles during migration of kwallet entries
@@ -14,66 +15,27 @@ class TestDBusKWallet(BackendBasicTests):
def init_keyring(self):
return kwallet.DBusKeyring()
- def cleanup(self):
- for item in self.credentials_created:
- # Suppress errors, as only one pre/post migration item will be
- # present
- try:
- self.keyring.delete_password(*item)
- except BaseException:
- pass
-
- # TODO Remove empty folders created during tests
-
- def set_password(self, service, username, password, old_format=False):
- # set the password and save the result so the test runner can clean
- # up after if necessary.
- self.credentials_created.add((service, username))
-
- if old_format:
- username = username + '@' + service
- service = 'Python'
-
- super().set_password(service, username, password)
-
- def check_set_get(self, service, username, password):
+ def test_credential(self):
keyring = self.keyring
- # for the non-existent password
- self.assertEqual(keyring.get_password(service, username), None)
+ # not supported from kwallets
+ #cred = keyring.get_credential('service', None)
+ #assert cred is None
- # common usage
- self.set_password(service, username, password, True)
- # re-init keyring to force migration
- self.keyring = keyring = self.init_keyring()
- ret_password = keyring.get_password(service, username)
- self.assertEqual(
- ret_password,
- password,
- "Incorrect password for username: '%s' "
- "on service: '%s'. '%s' != '%s'"
- % (service, username, ret_password, password),
- )
+ self.set_password('service1', 'user1', 'password1')
+ self.set_password('service1', 'user2', 'password2')
- # for the empty password
- self.set_password(service, username, "", True)
- # re-init keyring to force migration
- self.keyring = keyring = self.init_keyring()
- ret_password = keyring.get_password(service, username)
- self.assertEqual(
- ret_password,
- "",
- "Incorrect password for username: '%s' "
- "on service: '%s'. '%s' != '%s'" % (service, username, ret_password, ""),
+ cred = keyring.get_credential('service1', None)
+ assert cred is None or (cred.username, cred.password) in (
+ ('user1', 'password1'),
+ ('user2', 'password2'),
)
- ret_password = keyring.get_password('Python', username + '@' + service)
- self.assertEqual(
- ret_password,
- None,
- "Not 'None' password returned for username: '%s' "
- "on service: '%s'. '%s' != '%s'. Passwords from old "
- "folder should be deleted during migration."
- % (service, username, ret_password, None),
+
+ cred = keyring.get_credential('service1', 'user2')
+ assert cred is not None
+ assert (cred.username, cred.password) in (
+ ('user1', 'password1'),
+ ('user2', 'password2'),
)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c53e0e5ccde3ad34284a40ce7976b5b3a3d6de70344c3f8ee44364cc340976ec
size 55457

3
keyring-23.0.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:045703609dd3fccfcdb27da201684278823b72af515aedec1a8515719a038cb8
size 59185

View File

@ -1,3 +1,44 @@
-------------------------------------------------------------------
Thu Jun 17 14:52:19 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Update to 23.0.1:
* #504: Better error with invalid parameter to init_keyring.
* #505: Nicer documentation for headless Docker.
* Backends now all invoke ``set_properties_from_env`` on
self in the initializer. Derived backends should be sure
to invoke ``super().__init__()``.
* Use new entry points API from importlib_metadata 3.6.
* Added redundant type declarations for accessor functions
in ``keyring.core``.
* Added type declaration for ``keyring.core.get_keyring()``.
* #438: For better interoperability with other
applications, ``Windows`` backend now attempts to
decode passwords using UTF-8 if UTF-16 decoding fails.
Passwords are still stored as UTF-16.
* #437: Package now declares typing support.
* #403: Keyring no longer eagerly initializes the backend
on import, but instead defers the backend initialization
until a keyring is accessed. Any callers reliant on this
early intialization behavior may need to call
``keyring.core.init_backend()`` to explicitly initialize
the detected backend.
* #474: SecretService and KWallet backends are now
disabled if the relevant names are not available on
D-Bus. Keyring should now be much more responsive
in these environments.
* #463: Fixed regression in KWallet ``get_credential``
where a simple string was returned instead of a
SimpleCredential.
* #431: KWallet backend now supports ``get_credential``.
* #445: Suppress errors when ``sys.argv`` is not
a list of at least one element.
* #440: Keyring now honors XDG_CONFIG_HOME as
``~/.config``.
* #452: SecretService ``get_credential`` now returns
``None`` for unmatched query.
- Remove fix-kwallet-tests.patch, it doesn't seem to be necessary
anymore.
-------------------------------------------------------------------
Tue Feb 16 09:47:10 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -19,14 +19,14 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-keyring
Version: 21.2.1
Version: 23.0.1
Release: 0
Summary: System keyring service access from Python
License: Python-2.0 AND MIT
License: MIT AND Python-2.0
Group: Development/Languages/Python
URL: https://github.com/jaraco/keyring
Source: https://files.pythonhosted.org/packages/source/k/keyring/keyring-%{version}.tar.gz
Patch: fix-kwallet-tests.patch
# Patch: fix-kwallet-tests.patch
BuildRequires: %{python_module SecretStorage >= 3}
BuildRequires: %{python_module entrypoints}
BuildRequires: %{python_module importlib-metadata}
@ -42,7 +42,7 @@ Requires: python-importlib-metadata
Requires: python-jeepney >= 0.4.2
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(postun):update-alternatives
BuildArch: noarch
%python_subpackages
@ -51,8 +51,8 @@ The Python keyring lib provides a way to access the system keyring service
from python. It can be used in any application that needs safe password storage.
%prep
%setup -q -n keyring-%{version}
%patch -p1
%autosetup -p1 -n keyring-%{version}
%if 0%{?sle_version}
# keyring is not setting the egg version correctly without this:
sed -i -e '1a version=%{version}' setup.cfg