summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug_3759-fix-keyring-imports1
-rw-r--r--pkg/requirements.pip3
-rw-r--r--src/leap/bitmask/util/keyring_helpers.py19
3 files changed, 17 insertions, 6 deletions
diff --git a/changes/bug_3759-fix-keyring-imports b/changes/bug_3759-fix-keyring-imports
new file mode 100644
index 00000000..ed489633
--- /dev/null
+++ b/changes/bug_3759-fix-keyring-imports
@@ -0,0 +1 @@
+ o Fix keyring imports so we do not get import errors. Closes: #3759
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
index 081f3ba9..ce93b2ef 100644
--- a/pkg/requirements.pip
+++ b/pkg/requirements.pip
@@ -16,8 +16,7 @@ twisted
qt4reactor
python-gnupg
python-daemon # this should not be needed for Windows.
-
-keyring<=2.9 # See #3759
+keyring
leap.common>=0.3.2
leap.soledad.client>=0.3.0
diff --git a/src/leap/bitmask/util/keyring_helpers.py b/src/leap/bitmask/util/keyring_helpers.py
index 8f354f28..4b3eb57f 100644
--- a/src/leap/bitmask/util/keyring_helpers.py
+++ b/src/leap/bitmask/util/keyring_helpers.py
@@ -14,16 +14,21 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
"""
Keyring helpers.
"""
+import logging
import keyring
+from keyring.backends.file import EncryptedKeyring, PlaintextKeyring
+
+logger = logging.getLogger(__name__)
+
+
OBSOLETE_KEYRINGS = [
- keyring.backends.file.EncryptedKeyring,
- keyring.backends.file.PlaintextKeyring
+ EncryptedKeyring,
+ PlaintextKeyring
]
@@ -34,4 +39,10 @@ def has_keyring():
:rtype: bool
"""
kr = keyring.get_keyring()
- return kr is not None and kr.__class__ not in OBSOLETE_KEYRINGS
+ klass = kr.__class__
+ logger.debug("Selected keyring: %s" % (klass,))
+
+ canuse = kr is not None and klass not in OBSOLETE_KEYRINGS
+ if not canuse:
+ logger.debug("Not using this keyring since it is obsolete")
+ return canuse