[Python-modules-commits] [python-keyring] 01/05: Import python-keyring_6.1.orig.tar.gz

Dmitry Shachnev mitya57 at moszumanska.debian.org
Thu Jan 7 17:19:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository python-keyring.

commit 6b1f37da4d132044b8635a0ba08fb9be6e1def3a
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Thu Jan 7 20:13:20 2016 +0300

    Import python-keyring_6.1.orig.tar.gz
---
 .hgtags                                |  4 ++
 .travis.yml                            |  2 +-
 CHANGES.rst                            | 14 ++++++
 PKG-INFO                               | 38 ++++++---------
 README.rst                             | 30 ++++--------
 buildout.cfg                           | 33 -------------
 keyring.egg-info/PKG-INFO              | 38 ++++++---------
 keyring.egg-info/SOURCES.txt           |  1 -
 keyring/backend.py                     | 17 ++-----
 keyring/backends/kwallet.py            | 89 ++++++++++++++++++++++++++++++++--
 keyring/tests/backends/test_kwallet.py | 13 +++--
 keyring/util/__init__.py               | 10 +---
 setup.cfg                              |  4 +-
 setup.py                               | 18 +++----
 14 files changed, 169 insertions(+), 142 deletions(-)

diff --git a/.hgtags b/.hgtags
index 3e8e208..180577f 100644
--- a/.hgtags
+++ b/.hgtags
@@ -83,3 +83,7 @@ ec350f6cd8328edc404e6cbfd489b657cf7a2dea 5.3
 155b7078a68c14f4a8158e1154fd5c050acbcf2a 5.6
 b627f03618585eeb8df1d7403ac3637ece06d644 5.7
 a4a35ff779eb9125f2ec550e90a3a839bd8c48a9 5.7.1
+dc1cf8a793120e51c2d4b8f5a210048cb354f7f0 6.0
+dc1cf8a793120e51c2d4b8f5a210048cb354f7f0 6.0
+4f626f3936d782caba0cd63bd31df278a3528e49 6.0
+4da739a49d9e72e901111e2e4a86964a17fbf47d 6.1
diff --git a/.travis.yml b/.travis.yml
index 9640aaf..f564903 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,11 +2,11 @@ os:
   - linux
 language: python
 python:
-  - 2.6
   - 2.7
   - 3.2
   - 3.3
   - 3.4
+  - 3.5
 script:
   - pip install -U pytest
   - python setup.py test --addopts="-rs -v"
diff --git a/CHANGES.rst b/CHANGES.rst
index ba71ca6..89d0a8f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -2,6 +2,20 @@
 CHANGES
 =======
 
+---
+6.1
+---
+
+* Pull Request #174: Add DBus backend for KWallet, preferred to Qt
+  backend. Theoretically, it should be auto-detected based on
+  available libraries and interchangeable with the Qt backend.
+
+---
+6.0
+---
+
+* Drop support for Python 2.6.
+
 -----
 5.7.1
 -----
diff --git a/PKG-INFO b/PKG-INFO
index 20475e7..24a0c8a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: keyring
-Version: 5.7.1
+Version: 6.1
 Summary: Store and access your passwords safely.
 Home-page: https://github.com/jaraco/keyring
 Author: Jason R. Coombs
@@ -236,28 +236,27 @@ Description: =======================================
         .. _BuildStatus: http://travis-ci.org/jaraco/keyring
         
         To run the tests yourself, you'll want keyring installed to some environment
-        in which it can be tested. Three recommended techniques are described below.
+        in which it can be tested. Recommended techniques are described below.
         
         Using pytest runner
         -------------------
         
         Keyring is instrumented with `pytest runner
         <https://bitbucket.org/jaraco/pytest-runner>`_. Thus, you may invoke the tests
-        from any supported Python (with distribute installed) using this command::
+        from any supported Python (with setuptools installed) using this command::
         
-            python setup.py ptr
+            python setup.py test
         
         pytest runner will download any unmet dependencies and run the tests using
         `pytest <https://bitbucket.org/hpk42/pytest>`_.
         
         This technique is the one used by the Travis-CI script.
         
-        Using virtualenv and pytest/nose/unittest2
-        ------------------------------------------
+        Using virtualenv and pytest/nose/unittest
+        -----------------------------------------
         
         Pytest and Nose are two popular test runners that will discover tests and run
-        them. Unittest (unittest2 under Python 2.6) also has a mode
-        to discover tests.
+        them. Unittest also has a mode to discover tests.
         
         First, however, these test runners typically need a test environment in which
         to run. It is recommended that you install keyring to a virtual environment
@@ -270,6 +269,10 @@ Description: =======================================
         
             python setup.py develop
         
+        You then need to install the test requirements with something like:
+        
+            pip install `python -c "import setup, subprocess; print(subprocess.list2cmdline(setup.test_requirements))"`
+        
         Then, invoke your favorite test runner, e.g.::
         
             py.test
@@ -278,19 +281,6 @@ Description: =======================================
         
             nosetests
         
-        Using buildout
-        --------------
-        
-        Keyring supplies a buildout.cfg for use with buildout. If you have buildout
-        installed, tests can be invoked as so::
-        
-            1. bin/buildout  # prepare the buildout.
-            2. bin/test  # execute the test runner.
-        
-        For more information about the options that the script provides do execute::
-        
-            python bin/test --help
-        
         ----------
         Background
         ----------
@@ -308,6 +298,8 @@ Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Python Software Foundation License
 Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff --git a/README.rst b/README.rst
index 29f4628..20ed7ce 100644
--- a/README.rst
+++ b/README.rst
@@ -228,28 +228,27 @@ Travis-CI.
 .. _BuildStatus: http://travis-ci.org/jaraco/keyring
 
 To run the tests yourself, you'll want keyring installed to some environment
-in which it can be tested. Three recommended techniques are described below.
+in which it can be tested. Recommended techniques are described below.
 
 Using pytest runner
 -------------------
 
 Keyring is instrumented with `pytest runner
 <https://bitbucket.org/jaraco/pytest-runner>`_. Thus, you may invoke the tests
-from any supported Python (with distribute installed) using this command::
+from any supported Python (with setuptools installed) using this command::
 
-    python setup.py ptr
+    python setup.py test
 
 pytest runner will download any unmet dependencies and run the tests using
 `pytest <https://bitbucket.org/hpk42/pytest>`_.
 
 This technique is the one used by the Travis-CI script.
 
-Using virtualenv and pytest/nose/unittest2
-------------------------------------------
+Using virtualenv and pytest/nose/unittest
+-----------------------------------------
 
 Pytest and Nose are two popular test runners that will discover tests and run
-them. Unittest (unittest2 under Python 2.6) also has a mode
-to discover tests.
+them. Unittest also has a mode to discover tests.
 
 First, however, these test runners typically need a test environment in which
 to run. It is recommended that you install keyring to a virtual environment
@@ -262,6 +261,10 @@ the environment by running::
 
     python setup.py develop
 
+You then need to install the test requirements with something like:
+
+    pip install `python -c "import setup, subprocess; print(subprocess.list2cmdline(setup.test_requirements))"`
+
 Then, invoke your favorite test runner, e.g.::
 
     py.test
@@ -270,19 +273,6 @@ or::
 
     nosetests
 
-Using buildout
---------------
-
-Keyring supplies a buildout.cfg for use with buildout. If you have buildout
-installed, tests can be invoked as so::
-
-    1. bin/buildout  # prepare the buildout.
-    2. bin/test  # execute the test runner.
-
-For more information about the options that the script provides do execute::
-
-    python bin/test --help
-
 ----------
 Background
 ----------
diff --git a/buildout.cfg b/buildout.cfg
deleted file mode 100644
index 9687374..0000000
--- a/buildout.cfg
+++ /dev/null
@@ -1,33 +0,0 @@
-[buildout]
-parts = test interpreter
-develop = .
-allow-picked-versions = false
-use-dependency-links = false
-versions = versions
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = keyring [test]
-defaults = '--tests-pattern tests --exit-with-status'.split()
-working-directory = .
-
-[interpreter]
-recipe = zc.recipe.egg
-eggs = keyring
-interpreter = py
-
-[versions]
-# Maintain blank line below this comment to facilitate sorting.  (Vim: place
-# cursor anywhere in the version list and (in normal mode) type "vip:sort"
-# without the quotes.)
-
-distribute = 0.6.14
-setuptools = 0.6c11
-unittest2 = 0.5.1
-z3c.recipe.scripts = 1.0.1
-zc.buildout = 1.5.2
-zc.recipe.egg = 1.3.2
-zc.recipe.testrunner = 1.4.0
-zope.exceptions = 3.6.1
-zope.interface = 3.6.1
-zope.testrunner = 4.0.0
diff --git a/keyring.egg-info/PKG-INFO b/keyring.egg-info/PKG-INFO
index 20475e7..24a0c8a 100644
--- a/keyring.egg-info/PKG-INFO
+++ b/keyring.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: keyring
-Version: 5.7.1
+Version: 6.1
 Summary: Store and access your passwords safely.
 Home-page: https://github.com/jaraco/keyring
 Author: Jason R. Coombs
@@ -236,28 +236,27 @@ Description: =======================================
         .. _BuildStatus: http://travis-ci.org/jaraco/keyring
         
         To run the tests yourself, you'll want keyring installed to some environment
-        in which it can be tested. Three recommended techniques are described below.
+        in which it can be tested. Recommended techniques are described below.
         
         Using pytest runner
         -------------------
         
         Keyring is instrumented with `pytest runner
         <https://bitbucket.org/jaraco/pytest-runner>`_. Thus, you may invoke the tests
-        from any supported Python (with distribute installed) using this command::
+        from any supported Python (with setuptools installed) using this command::
         
-            python setup.py ptr
+            python setup.py test
         
         pytest runner will download any unmet dependencies and run the tests using
         `pytest <https://bitbucket.org/hpk42/pytest>`_.
         
         This technique is the one used by the Travis-CI script.
         
-        Using virtualenv and pytest/nose/unittest2
-        ------------------------------------------
+        Using virtualenv and pytest/nose/unittest
+        -----------------------------------------
         
         Pytest and Nose are two popular test runners that will discover tests and run
-        them. Unittest (unittest2 under Python 2.6) also has a mode
-        to discover tests.
+        them. Unittest also has a mode to discover tests.
         
         First, however, these test runners typically need a test environment in which
         to run. It is recommended that you install keyring to a virtual environment
@@ -270,6 +269,10 @@ Description: =======================================
         
             python setup.py develop
         
+        You then need to install the test requirements with something like:
+        
+            pip install `python -c "import setup, subprocess; print(subprocess.list2cmdline(setup.test_requirements))"`
+        
         Then, invoke your favorite test runner, e.g.::
         
             py.test
@@ -278,19 +281,6 @@ Description: =======================================
         
             nosetests
         
-        Using buildout
-        --------------
-        
-        Keyring supplies a buildout.cfg for use with buildout. If you have buildout
-        installed, tests can be invoked as so::
-        
-            1. bin/buildout  # prepare the buildout.
-            2. bin/test  # execute the test runner.
-        
-        For more information about the options that the script provides do execute::
-        
-            python bin/test --help
-        
         ----------
         Background
         ----------
@@ -308,6 +298,8 @@ Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Python Software Foundation License
 Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
diff --git a/keyring.egg-info/SOURCES.txt b/keyring.egg-info/SOURCES.txt
index 4faab54..c768d20 100644
--- a/keyring.egg-info/SOURCES.txt
+++ b/keyring.egg-info/SOURCES.txt
@@ -3,7 +3,6 @@
 .travis.yml
 CHANGES.rst
 README.rst
-buildout.cfg
 conftest.py
 hook-keyring.backend.py
 pytest.ini
diff --git a/keyring/backend.py b/keyring/backend.py
index 5df5235..3ea7462 100644
--- a/keyring/backend.py
+++ b/keyring/backend.py
@@ -6,11 +6,7 @@ from __future__ import absolute_import
 
 import abc
 import logging
-
-try:
-    import importlib
-except ImportError:
-    pass
+import importlib
 
 try:
     import pkg_resources
@@ -119,15 +115,8 @@ class NullCrypter(Crypter):
 
 def _load_backend(name):
     "Load a backend by name"
-    if 'importlib' in globals():
-        package = backends.__package__ or backends.__name__
-        mod = importlib.import_module('.'+name, package)
-    else:
-        # Python 2.6 support
-        ns = {}
-        exec("from .backends import {name} as mod".format(name=name),
-            globals(), ns)
-        mod = ns['mod']
+    package = backends.__package__ or backends.__name__
+    mod = importlib.import_module('.'+name, package)
     # invoke __name__ on each module to ensure it's loaded in demand-import
     # environments
     mod.__name__
diff --git a/keyring/backends/kwallet.py b/keyring/backends/kwallet.py
index 209b75d..c32cf52 100644
--- a/keyring/backends/kwallet.py
+++ b/keyring/backends/kwallet.py
@@ -1,6 +1,7 @@
 from __future__ import absolute_import
 
 import os
+import sys
 
 from ..py27compat import unicode_str
 from ..backend import KeyringBackend
@@ -9,9 +10,16 @@ from ..errors import PasswordSetError, ExceptionRaisedContext
 from ..util import properties
 from ..util import XDG
 
+# mixing Qt4 & Qt5 causes errors and may segfault
+if 'PyQt5' not in sys.modules:
+    try:
+        from PyKDE4.kdeui import KWallet
+        from PyQt4 import QtGui
+    except ImportError:
+        pass
+
 try:
-    from PyKDE4.kdeui import KWallet
-    from PyQt4 import QtGui
+    import dbus
 except ImportError:
     pass
 
@@ -51,7 +59,7 @@ def open_kwallet(kwallet_module=None, qt_module=None):
         if app:
             app.exit()
 
-class Keyring(KeyringBackend):
+class QtKeyring(KeyringBackend):
     """KDE KWallet"""
 
     @properties.ClassProperty
@@ -111,3 +119,78 @@ class Keyring(KeyringBackend):
         if wallet.keyDoesNotExist(wallet.walletName(), 'Python', key):
             raise PasswordDeleteError("Password not found")
         wallet.removeEntry(key)
+
+
+class DBusKeyring(KeyringBackend):
+    """KDE KWallet via D-Bus"""
+
+    @properties.ClassProperty
+    @classmethod
+    @XDG.Preference('KDE')
+    def priority(cls):
+        if 'dbus' not in globals():
+            raise RuntimeError('python-dbus not installed')
+        # make sure kwalletd is accessible
+        bus = dbus.SessionBus()
+        try:
+            bus.get_object('org.kde.kwalletd', '/modules/kwalletd')
+        except dbus.DBusException:
+            raise RuntimeError('cannot connect to org.kde.kwalletd')
+        return 5.1
+
+    def __init__(self, *arg, **kw):
+        super(DBusKeyring, self).__init__(*arg, **kw)
+        self.handle = -1
+
+    def connected(self):
+        if self.handle >= 0:
+            return True
+        bus = dbus.SessionBus()
+        wId = 0
+        self.folder = 'Python'
+        self.appid = 'Python program'
+        try:
+            remote_obj = bus.get_object('org.kde.kwalletd', '/modules/kwalletd')
+            self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
+            self.handle = self.iface.open(
+                        self.iface.networkWallet(), wId, self.appid)
+        except dbus.DBusException:
+            self.handle = -1
+        if self.handle < 0:
+            return False
+        if not self.iface.hasFolder(self.handle, self.folder, self.appid):
+            self.iface.createFolder(self.handle, self.folder, self.appid)
+        return True
+
+    def get_password(self, service, username):
+        """Get password of the username for the service
+        """
+        key = username + '@' + service
+        if not self.connected():
+            # the user pressed "cancel" when prompted to unlock their keyring.
+            return None
+        if not self.iface.hasEntry(self.handle, self.folder, key, self.appid):
+            return None
+        return self.iface.readPassword(
+            self.handle, self.folder, key, self.appid)
+
+    def set_password(self, service, username, password):
+        """Set password for the username of the service
+        """
+        key = username + '@' + service
+        if not self.connected():
+            # the user pressed "cancel" when prompted to unlock their keyring.
+            raise PasswordSetError("Cancelled by user")
+        self.iface.writePassword(
+            self.handle, self.folder, key, password, self.appid)
+
+    def delete_password(self, service, username):
+        """Delete the password for the username of the service.
+        """
+        key = username + '@' + service
+        if not self.connected():
+            # the user pressed "cancel" when prompted to unlock their keyring.
+            raise PasswordDeleteError("Cancelled by user")
+        if not self.iface.hasEntry(self.handle, self.folder, key, self.appid):
+            raise PasswordDeleteError("Password not found")
+        self.iface.removeEntry(self.handle, self.folder, key, self.appid)
diff --git a/keyring/tests/backends/test_kwallet.py b/keyring/tests/backends/test_kwallet.py
index f55f93a..2df8b1c 100644
--- a/keyring/tests/backends/test_kwallet.py
+++ b/keyring/tests/backends/test_kwallet.py
@@ -10,11 +10,11 @@ def is_qt4_supported():
         return False
     return True
 
- at unittest.skipUnless(kwallet.Keyring.viable, "Need KWallet")
+ at unittest.skipUnless(kwallet.QtKeyring.viable, "Need KWallet")
 class KDEKWalletTestCase(BackendBasicTests, unittest.TestCase):
 
     def init_keyring(self):
-        return kwallet.Keyring()
+        return kwallet.QtKeyring()
 
 
 class UnOpenableKWallet(object):
@@ -64,7 +64,7 @@ class KDEWalletCanceledTestCase(unittest.TestCase):
             None)
 
 
- at unittest.skipUnless(kwallet.Keyring.viable and
+ at unittest.skipUnless(kwallet.QtKeyring.viable and
                      is_qt4_supported(),
                      "Need KWallet and Qt4")
 class KDEKWalletInQApplication(unittest.TestCase):
@@ -79,3 +79,10 @@ class KDEKWalletInQApplication(unittest.TestCase):
         wallet = kwallet.open_kwallet()
         self.assertIsInstance(wallet, KWallet.Wallet)
         app.exit()
+
+
+ at unittest.skipUnless(kwallet.DBusKeyring.viable, "Need DBus")
+class DBusKWalletTestCase(BackendBasicTests, unittest.TestCase):
+
+    def init_keyring(self):
+        return kwallet.DBusKeyring()
diff --git a/keyring/util/__init__.py b/keyring/util/__init__.py
index d67d8ab..9a29d16 100644
--- a/keyring/util/__init__.py
+++ b/keyring/util/__init__.py
@@ -1,8 +1,4 @@
-try:
-    import functools
-except ImportError:
-    # functools not available until Python 2.5
-    pass
+import functools
 
 def once(func):
     """
@@ -23,9 +19,7 @@ def once(func):
         if not hasattr(func, 'always_returns'):
             func.always_returns = func(*args, **kwargs)
         return func.always_returns
-    if 'functools' in globals():
-        wrapper = functools.wraps(func)(wrapper)
-    return wrapper
+    return functools.wraps(func)(wrapper)
 
 def suppress_exceptions(callables, exceptions=Exception):
     """
diff --git a/setup.cfg b/setup.cfg
index b63a58a..4d55109 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,7 +6,7 @@ test = pytest
 universal = 1
 
 [egg_info]
-tag_svn_revision = 0
-tag_date = 0
 tag_build = 
+tag_date = 0
+tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index 19613e9..ae324b9 100644
--- a/setup.py
+++ b/setup.py
@@ -10,11 +10,11 @@ import setuptools
 with io.open('README.rst', encoding='utf-8') as readme:
     long_description = readme.read()
 
-needs_pytest = set(['pytest', 'test']).intersection(sys.argv)
+needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
 pytest_runner = ['pytest_runner'] if needs_pytest else []
-needs_sphinx = set(['release', 'build_sphinx', 'upload_docs']).intersection(sys.argv)
+needs_sphinx = {'release', 'build_sphinx', 'upload_docs'}.intersection(sys.argv)
 sphinx = ['sphinx'] if needs_sphinx else []
-needs_wheel = set(['release', 'bdist_wheel']).intersection(sys.argv)
+needs_wheel = {'release', 'bdist_wheel'}.intersection(sys.argv)
 wheel = ['wheel'] if needs_wheel else []
 
 test_requirements = [
@@ -27,12 +27,6 @@ test_requirements = [
 ]
 "dependencies for running tests"
 
-if sys.version_info < (2, 7) or (
-        sys.version_info >= (3, 0) and sys.version_info < (3, 1)):
-    # Require unittest2 for Python which doesn't contain the new unittest
-    # module (appears in Python 2.7 and Python 3.1)
-    test_requirements.append('unittest2')
-
 if sys.version_info >= (3, 0):
     # gdata doesn't currently install on Python 3. Omit it also.
     # http://code.google.com/p/gdata-python-client/issues/detail?id=229
@@ -69,9 +63,11 @@ setup_params = dict(
         "Intended Audience :: Developers",
         "License :: OSI Approved :: Python Software Foundation License",
         "License :: OSI Approved :: MIT License",
-        "Programming Language :: Python :: 2.6",
         "Programming Language :: Python :: 2.7",
-        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.2",
+        "Programming Language :: Python :: 3.3",
+        "Programming Language :: Python :: 3.4",
+        "Programming Language :: Python :: 3.5",
     ],
     entry_points={
         'console_scripts': [

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-keyring.git



More information about the Python-modules-commits mailing list