[Python-apps-commits] r12777 - in packages/kupfer/trunk/debian (2 files)

mitya57 at users.alioth.debian.org mitya57 at users.alioth.debian.org
Sun Feb 7 16:58:47 UTC 2016


    Date: Sunday, February 7, 2016 @ 16:58:45
  Author: mitya57
Revision: 12777

Update debian/patches/keyring-3.patch to work with modern versions of
Keyring (use public API where possible instead of relying on internals).

Modified:
  packages/kupfer/trunk/debian/changelog
  packages/kupfer/trunk/debian/patches/keyring-3.patch

Modified: packages/kupfer/trunk/debian/changelog
===================================================================
--- packages/kupfer/trunk/debian/changelog	2016-02-04 08:50:38 UTC (rev 12776)
+++ packages/kupfer/trunk/debian/changelog	2016-02-07 16:58:45 UTC (rev 12777)
@@ -1,3 +1,10 @@
+kupfer (0+v208-6) UNRELEASED; urgency=medium
+
+  * Update debian/patches/keyring-3.patch to work with modern versions of
+    Keyring (use public API where possible instead of relying on internals).
+
+ -- Dmitry Shachnev <mitya57 at debian.org>  Sun, 07 Feb 2016 19:56:38 +0300
+
 kupfer (0+v208-5) unstable; urgency=medium
 
   * debian/patches/bookmarks-places.sqlite.patch:

Modified: packages/kupfer/trunk/debian/patches/keyring-3.patch
===================================================================
--- packages/kupfer/trunk/debian/patches/keyring-3.patch	2016-02-04 08:50:38 UTC (rev 12776)
+++ packages/kupfer/trunk/debian/patches/keyring-3.patch	2016-02-07 16:58:45 UTC (rev 12777)
@@ -1,50 +1,56 @@
-Description: Adopt to new keyring backend locations
- keyring.backend is deprecated since python-keyring 1.1 and has been replaced by
- keyring.backends. The compatibility module has been dropped in python-keyring
- 3.0 and thus kupfer needs to use keyring.backends. This is done by checking the
- new location first and falling back to the old location on ImportError.
+Description: Adopt to new keyring API
+ Update Kupfer plugin support code to work with modern python-keyring versions:
+ .
+  * Use priority property for a rough check if the keyring is encrypted.
+  * Use __doc__ to get the human-readable keyring name.
+  * Use filename attribute to set the filename for file-based backends.
 Author: Sebastian Ramacher <sramacher at debian.org>
+Author: Dmitry Shachnev <mitya57 at debian.org>
 Bug-Debian: http://bugs.debian.org/728468
-Last-Update: 2013-12-05
+Last-Update: 2016-02-07
 
 --- a/kupfer/plugin_support.py
 +++ b/kupfer/plugin_support.py
-@@ -166,11 +166,18 @@
+@@ -160,21 +160,14 @@
+ 
  	@classmethod
+ 	def is_backend_encrypted(cls):
+-		import keyring.core
+-		return keyring.core.get_keyring().supported() == 1
++		import keyring
++		# Plaintext keyring backend has priority 0.5, other ones have higher
++		return keyring.get_keyring().priority > 0.5
+ 
+ 	@classmethod
  	def get_backend_name(cls):
- 		import keyring.core
+-		import keyring.core
 -		import keyring.backend
-+		try:
-+			from keyring.backends.Gnome import Keyring as GnomeKeyring
-+			from keyring.backends.kwallet import Keyring as KDEKWallet
-+			from keyring.backends.file import PlaintextKeyring as UncryptedFileKeyring
-+		except ImportError:
-+			from keyring.backend import GnomeKeyring
-+			from keyring.backend import KDEKWallet
-+			from keyring.backend import UncryptedFileKeyring
- 		keyring_map = {
+-		keyring_map = {
 -				keyring.backend.GnomeKeyring : _("GNOME Keyring"),
 -				keyring.backend.KDEKWallet : _("KWallet"),
 -				keyring.backend.UncryptedFileKeyring: _("Unencrypted File"),
-+				GnomeKeyring : _("GNOME Keyring"),
-+				KDEKWallet : _("KWallet"),
-+				UncryptedFileKeyring: _("Unencrypted File"),
- 			}
- 		kr = keyring.get_keyring()
- 		keyring_name = keyring_map.get(type(kr), type(kr).__name__)
-@@ -209,10 +216,13 @@
+-			}
+-		kr = keyring.get_keyring()
+-		keyring_name = keyring_map.get(type(kr), type(kr).__name__)
+-		return keyring_name
++		import keyring
++		return keyring.get_keyring().__doc__
+ 
+ 	def load(self, plugin_id, key, username):
+ 		self.password = keyring.get_password(plugin_id, username)
+@@ -209,13 +202,9 @@
  		raise
  	else:
  		# Configure the fallback keyring's configuration file if used
 -		import keyring.backend
  		kr = keyring.get_keyring()
- 		if hasattr(kr, "crypted_password"):
+-		if hasattr(kr, "crypted_password"):
 -			keyring.set_keyring(keyring.backend.UncryptedFileKeyring())
-+			try:
-+				from keyring.backends.file import PlaintextKeyring as UncryptedFileKeyring
-+			except ImportError:
-+				from keyring.backend import UncryptedFileKeyring
-+			keyring.set_keyring(UncryptedFileKeyring())
- 			kr = keyring.get_keyring()
- 		if hasattr(kr, "file_path"):
- 			kr.file_path = config.save_config_file("keyring.cfg")
+-			kr = keyring.get_keyring()
+-		if hasattr(kr, "file_path"):
+-			kr.file_path = config.save_config_file("keyring.cfg")
++		if hasattr(kr, "filename"):
++			kr.filename = config.save_config_file("keyring.cfg")
+ 	finally:
+ 		# now unblock kde libraries again
+ 		if old_pykde4:




More information about the Python-apps-commits mailing list