SHA256
1
0
forked from pool/python-twine
python-twine/fix-keyring-support.patch

36 lines
932 B
Diff

From 5e80bfa08808b15a340687f8224d449fa906ac8e Mon Sep 17 00:00:00 2001
From: Dustin Ingram <di@users.noreply.github.com>
Date: Mon, 1 Oct 2018 16:30:32 -0500
Subject: [PATCH] Fix keyring support
---
twine/utils.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/twine/utils.py b/twine/utils.py
index 83a1867..57eefb3 100644
--- a/twine/utils.py
+++ b/twine/utils.py
@@ -35,6 +35,11 @@
except ImportError:
from urllib.parse import urlparse, urlunparse
+try:
+ import keyring # noqa
+except ImportError:
+ pass
+
from twine import exceptions
# Shim for raw_input in python3
@@ -211,8 +216,7 @@ def get_password_from_keyring(system, username):
return
try:
- import keyring
- return keyring.get_password(system, username)
+ return sys.modules['keyring'].get_password(system, username)
except Exception as exc:
warnings.warn(str(exc))