[Python-modules-commits] [python-keyring] 01/03: Import python-keyring_10.3.1.orig.tar.gz
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Tue Mar 21 10:39:40 UTC 2017
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch master
in repository python-keyring.
commit cb689f62bb3fb0351b84ff60790e2bae9a9ce12e
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Tue Mar 21 12:57:42 2017 +0300
Import python-keyring_10.3.1.orig.tar.gz
---
.travis.yml | 17 +++--
CHANGES.rst | 25 +++++++
PKG-INFO | 3 +-
appveyor.yml | 4 ++
conftest.py | 7 ++
docs/conf.py | 57 ++++++++++------
keyring.egg-info/PKG-INFO | 3 +-
keyring.egg-info/SOURCES.txt | 1 +
keyring.egg-info/entry_points.txt | 3 +
keyring/backends/SecretService.py | 3 +-
keyring/backends/Windows.py | 4 +-
keyring/backends/_OS_X_API.py | 135 +++++++++++++++++++++++++++++++++++++-
keyring/devpi_client.py | 10 +++
keyring/py27compat.py | 6 +-
pytest.ini | 2 +-
setup.cfg | 3 -
setup.py | 14 ++--
tests/requirements.txt | 1 +
18 files changed, 248 insertions(+), 50 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 348689f..44000b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,12 @@
language: python
+python:
+ - 2.7
+ - 3.3
+ - 3.4
+ - 3.5
+ - 3.6
matrix:
include:
- - os: linux
- python: 2.7
- - os: linux
- python: 3.3
- - os: linux
- python: 3.4
- - os: linux
- python: 3.5
- os: osx
language: generic
@@ -28,8 +26,9 @@ deploy:
on:
tags: true
all_branches: true
- python: 3.5
+ python: 3.6
user: jaraco
password:
secure: aDqlVdm6FZ8pqLkoDRR2LH3TEz7pBvKH2HhOlSy7OEmopN/36ncql/KvfE0ccpaOES9Xm31a51bUfNjcwb1HVKjfW544C+IoSHctkG1rI5bp3q4rW+4RbQcBZVHUUKR9yQf9ZyikEmoYXi3g+JKcOf9rj+v/32PAfUDzSpFbWik=
distributions: dists
+ skip_upload_docs: true
diff --git a/CHANGES.rst b/CHANGES.rst
index c502906..9e7ee49 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,25 @@
+10.3.1
+------
+
+* #266: Use private compatibity model rather than six to
+ avoid the dependency.
+
+10.3
+----
+
+* #264: Implement devpi hook for supplying a password when
+ logging in with `devpi <https://pypi.org/project/devpi>`_
+ client.
+
+* #260: For macOS, added initial API support for internet
+ passwords.
+
+10.2
+----
+
+* #259: Allow to set a custom application attribute for
+ SecretService backend.
+
10.1
----
@@ -69,6 +91,9 @@
users will be prompted to authorize the system Python
executable and also new Python executables, such as
those created by virtualenv.
+ #260: No longer does the keyring honor the ``store``
+ attribute on the keyring. Only application passwords
+ are accessible.
8.7
---
diff --git a/PKG-INFO b/PKG-INFO
index 55533d8..98289e6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: keyring
-Version: 10.1
+Version: 10.3.1
Summary: Store and access your passwords safely.
Home-page: https://github.com/jaraco/keyring
Author: Jason R. Coombs
@@ -331,3 +331,4 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/appveyor.yml b/appveyor.yml
index 47da287..df671b0 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -17,3 +17,7 @@ build: off
test_script:
- "python -m pip install tox"
- "tox -- -rs -v"
+
+branches:
+ except:
+ - skeleton
diff --git a/conftest.py b/conftest.py
index 971898a..5d0a1dc 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,3 +1,10 @@
+import platform
+
collect_ignore = [
"hook-keyring.backend.py",
]
+
+if platform.system() != 'Darwin':
+ collect_ignore.append('keyring/backends/_OS_X_API.py')
+
+collect_ignore.append('keyring/devpi_client.py')
diff --git a/docs/conf.py b/docs/conf.py
index 7066288..7402c7a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,12 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-import pkg_resources
+import os
+import sys
+import subprocess
+
+if 'check_output' not in dir(subprocess):
+ import subprocess32 as subprocess
extensions = [
'sphinx.ext.autodoc',
@@ -9,31 +14,41 @@ extensions = [
]
# General information about the project.
-project = 'keyring'
-copyright = '2015-2016 Jason R. Coombs'
-# The short X.Y version.
-version = pkg_resources.require(project)[0].version
+root = os.path.join(os.path.dirname(__file__), '..')
+setup_script = os.path.join(root, 'setup.py')
+fields = ['--name', '--version', '--url', '--author']
+dist_info_cmd = [sys.executable, setup_script] + fields
+output_bytes = subprocess.check_output(dist_info_cmd, cwd=root)
+project, version, url, author = output_bytes.decode('utf-8').strip().split('\n')
+
+copyright = '2016 ' + author
+
# The full version, including alpha/beta/rc tags.
release = version
master_doc = 'index'
link_files = {
- '../CHANGES.rst': dict(
- using=dict(
- GH='https://github.com',
- project=project,
- ),
- replace=[
- dict(
- pattern=r"(Issue )?#(?P<issue>\d+)",
- url='{GH}/jaraco/{project}/issues/{issue}',
- ),
- dict(
- pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
- with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
- ),
- ],
- ),
+ '../CHANGES.rst': dict(
+ using=dict(
+ GH='https://github.com',
+ project=project,
+ url=url,
+ ),
+ replace=[
+ dict(
+ pattern=r"(Issue )?#(?P<issue>\d+)",
+ url='{url}/issues/{issue}',
+ ),
+ dict(
+ pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
+ with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
+ ),
+ dict(
+ pattern=r"PEP[- ](?P<pep_number>\d+)",
+ url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
+ ),
+ ],
+ ),
}
diff --git a/keyring.egg-info/PKG-INFO b/keyring.egg-info/PKG-INFO
index 55533d8..98289e6 100644
--- a/keyring.egg-info/PKG-INFO
+++ b/keyring.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: keyring
-Version: 10.1
+Version: 10.3.1
Summary: Store and access your passwords safely.
Home-page: https://github.com/jaraco/keyring
Author: Jason R. Coombs
@@ -331,3 +331,4 @@ Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/keyring.egg-info/SOURCES.txt b/keyring.egg-info/SOURCES.txt
index 9d4c2bb..45b9cca 100644
--- a/keyring.egg-info/SOURCES.txt
+++ b/keyring.egg-info/SOURCES.txt
@@ -20,6 +20,7 @@ keyring/backend.py
keyring/cli.py
keyring/core.py
keyring/credentials.py
+keyring/devpi_client.py
keyring/errors.py
keyring/getpassbackend.py
keyring/http.py
diff --git a/keyring.egg-info/entry_points.txt b/keyring.egg-info/entry_points.txt
index b550864..42e1124 100644
--- a/keyring.egg-info/entry_points.txt
+++ b/keyring.egg-info/entry_points.txt
@@ -1,3 +1,6 @@
[console_scripts]
keyring = keyring.cli:main
+[devpi_client]
+keyring = keyring.devpi_client
+
diff --git a/keyring/backends/SecretService.py b/keyring/backends/SecretService.py
index 9f7fe74..1086d5c 100644
--- a/keyring/backends/SecretService.py
+++ b/keyring/backends/SecretService.py
@@ -15,6 +15,7 @@ log = logging.getLogger(__name__)
class Keyring(KeyringBackend):
"""Secret Service Keyring"""
+ appid = "python-keyring"
@properties.ClassProperty
@classmethod
@@ -68,7 +69,7 @@ class Keyring(KeyringBackend):
"""
collection = self.get_preferred_collection()
attributes = {
- "application": "python-keyring",
+ "application": self.appid,
"service": service,
"username": username
}
diff --git a/keyring/backends/Windows.py b/keyring/backends/Windows.py
index 5acda28..7f08e15 100644
--- a/keyring/backends/Windows.py
+++ b/keyring/backends/Windows.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
import functools
-from ..py27compat import unicode_str
+from ..py27compat import text_type
from ..util import properties
from ..backend import KeyringBackend
from ..errors import PasswordDeleteError, ExceptionRaisedContext
@@ -96,7 +96,7 @@ class WinVaultKeyring(KeyringBackend):
target = self._compound_name(existing_username, service)
self._set_password(target, existing_username,
existing_pw['CredentialBlob'].decode('utf-16'))
- self._set_password(service, username, unicode_str(password))
+ self._set_password(service, username, text_type(password))
def _set_password(self, target, username, password):
credential = dict(Type=win32cred.CRED_TYPE_GENERIC,
diff --git a/keyring/backends/_OS_X_API.py b/keyring/backends/_OS_X_API.py
index c1c661e..33e6ff2 100644
--- a/keyring/backends/_OS_X_API.py
+++ b/keyring/backends/_OS_X_API.py
@@ -1,7 +1,11 @@
import contextlib
import ctypes
+import struct
from ctypes import c_void_p, c_uint16, c_uint32, c_int32, c_char_p, POINTER
+from keyring.py27compat import string_types, add_metaclass
+
+
sec_keychain_ref = sec_keychain_item_ref = c_void_p
OS_status = c_int32
@@ -109,14 +113,95 @@ SecKeychainFindInternetPassword.argtypes = (
c_uint32, # pathLength
c_char_p, # path
c_uint16, # port
- c_void_p, # SecProtocolType protocol,
- c_void_p, # SecAuthenticationType authenticationType,
+ c_uint32, # SecProtocolType protocol,
+ c_uint32, # SecAuthenticationType authenticationType,
POINTER(c_uint32), # passwordLength
POINTER(c_void_p), # passwordData
POINTER(sec_keychain_item_ref), # itemRef
)
SecKeychainFindInternetPassword.restype = OS_status
+
+class PackedAttributes(type):
+ """
+ Take the attributes which use magic words
+ to represent enumerated constants and generate
+ the constants.
+ """
+ def __new__(cls, name, bases, dict):
+ dict.update(
+ (key, cls.unpack(val))
+ for key, val in dict.items()
+ if not key.startswith('_')
+ )
+ return super(PackedAttributes, cls).__new__(cls, name, bases, dict)
+
+ @staticmethod
+ def unpack(word):
+ r"""
+ >>> PackedAttributes.unpack(0)
+ 0
+ >>> PackedAttributes.unpack('\x00\x00\x00\x01')
+ 1
+ >>> PackedAttributes.unpack('abcd')
+ 1633837924
+ """
+ if not isinstance(word, string_types):
+ return word
+ val, = struct.unpack('!I', word.encode('ascii'))
+ return val
+
+
+ at add_metaclass(PackedAttributes)
+class SecProtocolType(object):
+ kSecProtocolTypeHTTP = 'http'
+ kSecProtocolTypeHTTPS = 'htps'
+ kSecProtocolTypeFTP = 'ftp '
+
+
+ at add_metaclass(PackedAttributes)
+class SecAuthenticationType(object):
+ """
+ >>> SecAuthenticationType.kSecAuthenticationTypeDefault
+ 1684434036
+ """
+ kSecAuthenticationTypeDefault = 'dflt'
+ kSecAuthenticationTypeAny = 0
+
+
+def find_internet_password(kc_name, service, username):
+ username = username.encode('utf-8')
+ domain = None
+ service = service.encode('utf-8')
+ path = None
+ port = 0
+
+ with open(kc_name) as keychain:
+ length = c_uint32()
+ data = c_void_p()
+ status = SecKeychainFindInternetPassword(
+ keychain,
+ len(service), service,
+ 0, domain,
+ len(username), username,
+ 0, path,
+ port,
+ SecProtocolType.kSecProtocolTypeHTTPS,
+ SecAuthenticationType.kSecAuthenticationTypeAny,
+ length,
+ data,
+ None,
+ )
+
+ msg = "Can't fetch password from system"
+ NotFound.raise_for_status(status, msg)
+
+ password = ctypes.create_string_buffer(length.value)
+ ctypes.memmove(password, data.value, length.value)
+ SecKeychainItemFreeContent(None, data)
+ return password.raw.decode('utf-8')
+
+
SecKeychainAddGenericPassword = _sec.SecKeychainAddGenericPassword
SecKeychainAddGenericPassword.argtypes = (
sec_keychain_ref,
@@ -157,6 +242,52 @@ def set_generic_password(name, service, username, password):
NotFound.raise_for_status(status, "Unable to set password")
+SecKeychainAddInternetPassword = _sec.SecKeychainAddInternetPassword
+SecKeychainAddInternetPassword.argtypes = (
+ sec_keychain_ref, # keychainOrArray
+ c_uint32, # serverNameLength
+ c_char_p, # serverName
+ c_uint32, # securityDomainLength
+ c_char_p, # securityDomain
+ c_uint32, # accountNameLength
+ c_char_p, # accountName
+ c_uint32, # pathLength
+ c_char_p, # path
+ c_uint16, # port
+ c_uint32, # SecProtocolType protocol,
+ c_uint32, # SecAuthenticationType authenticationType,
+ c_uint32, # passwordLength
+ c_void_p, # passwordData
+ POINTER(sec_keychain_item_ref), # itemRef
+)
+SecKeychainAddInternetPassword.restype = OS_status
+
+
+def set_internet_password(name, service, username, password):
+ username = username.encode('utf-8')
+ domain = None
+ service = service.encode('utf-8')
+ password = password.encode('utf-8')
+ path = None
+ port = 0
+ with open(name) as keychain:
+ # TODO: Use update or set technique as seen in set_generic_password
+ status = SecKeychainAddInternetPassword(
+ keychain,
+ len(service), service,
+ 0, domain,
+ len(username), username,
+ 0, path,
+ port,
+ SecProtocolType.kSecProtocolTypeHTTPS,
+ SecAuthenticationType.kSecAuthenticationTypeAny,
+ len(password), password,
+ None,
+ )
+
+ NotFound.raise_for_status(status, "Unable to set password")
+
+
SecKeychainItemModifyAttributesAndData = _sec.SecKeychainItemModifyAttributesAndData
SecKeychainItemModifyAttributesAndData.argtypes = (
sec_keychain_item_ref, c_void_p, c_uint32, c_void_p,
diff --git a/keyring/devpi_client.py b/keyring/devpi_client.py
new file mode 100644
index 0000000..19e5f10
--- /dev/null
+++ b/keyring/devpi_client.py
@@ -0,0 +1,10 @@
+from pluggy import HookimplMarker
+
+import keyring
+
+
+hookimpl = HookimplMarker("devpiclient")
+
+ at hookimpl()
+def devpiclient_get_password(url, username):
+ return keyring.get_password(url, username)
diff --git a/keyring/py27compat.py b/keyring/py27compat.py
index fffcfb7..3e45737 100644
--- a/keyring/py27compat.py
+++ b/keyring/py27compat.py
@@ -13,9 +13,11 @@ except NameError:
input = input
try:
- unicode_str = unicode
+ text_type = unicode
+ string_types = unicode, str
except NameError:
- unicode_str = str
+ text_type = str
+ string_types = str,
try:
import cPickle as pickle
diff --git a/pytest.ini b/pytest.ini
index cb64ee4..56a8774 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,4 +1,4 @@
[pytest]
norecursedirs=dist build .tox
-addopts=--doctest-modules --ignore keyring/backends/_OS_X_API.py
+addopts=--doctest-modules
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
diff --git a/setup.cfg b/setup.cfg
index c1794d2..447e8f2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,9 +5,6 @@ dists = clean --all sdist bdist_wheel
[wheel]
universal = 1
-[upload]
-repository = https://upload.pypi.org/legacy/
-
[egg_info]
tag_build =
tag_date = 0
diff --git a/setup.py b/setup.py
index 05f9ed6..a886061 100644
--- a/setup.py
+++ b/setup.py
@@ -3,20 +3,16 @@
# Project skeleton maintained at https://github.com/jaraco/skeleton
import io
-import sys
import setuptools
with io.open('README.rst', encoding='utf-8') as readme:
long_description = readme.read()
-needs_wheel = {'release', 'bdist_wheel', 'dists'}.intersection(sys.argv)
-wheel = ['wheel'] if needs_wheel else []
-
name = 'keyring'
description = 'Store and access your passwords safely.'
-setup_params = dict(
+params = dict(
name=name,
use_scm_version=True,
author="Kang Zhang",
@@ -39,7 +35,7 @@ setup_params = dict(
},
setup_requires=[
'setuptools_scm>=1.15.0',
- ] + wheel,
+ ],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
@@ -49,12 +45,16 @@ setup_params = dict(
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
],
entry_points={
'console_scripts': [
'keyring=keyring.cli:main',
],
+ 'devpi_client': [
+ 'keyring = keyring.devpi_client',
+ ],
},
)
if __name__ == '__main__':
- setuptools.setup(**setup_params)
+ setuptools.setup(**params)
diff --git a/tests/requirements.txt b/tests/requirements.txt
index 70bc02f..ab48405 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -1 +1,2 @@
pytest >= 2.8
+subprocess32; python_version=="2.6"
--
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