removed .decode('ascii') and added missing bytestrings

nistp521
Dominik Kozaczko 8 years ago
parent 1fa35e7f1a
commit 3aebd137b0
No known key found for this signature in database
GPG Key ID: 599FD881A588E191

@ -9,7 +9,8 @@ setup(
author_email='roman.zeyde@gmail.com', author_email='roman.zeyde@gmail.com',
url='http://github.com/romanz/trezor-agent', url='http://github.com/romanz/trezor-agent',
packages=['trezor_agent', 'trezor_agent.gpg'], packages=['trezor_agent', 'trezor_agent.gpg'],
install_requires=['ecdsa>=0.13', 'ed25519>=1.4', 'Cython>=0.23.4', 'protobuf>=3.0.0', 'trezor>=0.7.4', 'semver>=2.2'], install_requires=['ecdsa>=0.13', 'ed25519>=1.4', 'Cython>=0.23.4', 'protobuf>=3.0.0', 'trezor>=0.7.4', 'semver>=2.2',
'keepkey>=0.7.3'],
platforms=['POSIX'], platforms=['POSIX'],
classifiers=[ classifiers=[
'Environment :: Console', 'Environment :: Console',

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py27,py34 envlist = py27,py3
[pep8] [pep8]
max-line-length = 100 max-line-length = 100
[testenv] [testenv]

@ -1,4 +1,5 @@
"""Thin wrapper around trezor/keepkey libraries.""" """Thin wrapper around trezor/keepkey libraries."""
from __future__ import absolute_import
import binascii import binascii
import collections import collections
import logging import logging

@ -1,4 +1,5 @@
"""Tools for doing signature using gpg-agent.""" """Tools for doing signature using gpg-agent."""
from __future__ import unicode_literals, absolute_import, print_function
import binascii import binascii
import io import io
@ -15,8 +16,8 @@ log = logging.getLogger(__name__)
def get_agent_sock_path(sp=subprocess): def get_agent_sock_path(sp=subprocess):
"""Parse gpgconf output to find out GPG agent UNIX socket path.""" """Parse gpgconf output to find out GPG agent UNIX socket path."""
lines = sp.check_output(['gpgconf', '--list-dirs']).strip().split('\n') lines = sp.check_output(['gpgconf', '--list-dirs']).strip().split(b'\n')
dirs = dict(line.split(':', 1) for line in lines) dirs = dict(line.split(b':', 1) for line in lines)
return dirs['agent-socket'] return dirs['agent-socket']
@ -183,14 +184,14 @@ def gpg_command(args, env=None):
def get_keygrip(user_id, sp=subprocess): def get_keygrip(user_id, sp=subprocess):
"""Get a keygrip of the primary GPG key of the specified user.""" """Get a keygrip of the primary GPG key of the specified user."""
args = gpg_command(['--list-keys', '--with-keygrip', user_id]) args = gpg_command(['--list-keys', '--with-keygrip', user_id])
output = sp.check_output(args).decode('ascii') output = sp.check_output(args)
return re.findall(r'Keygrip = (\w+)', output)[0] return re.findall(r'Keygrip = (\w+)', output)[0]
def gpg_version(sp=subprocess): def gpg_version(sp=subprocess):
"""Get a keygrip of the primary GPG key of the specified user.""" """Get a keygrip of the primary GPG key of the specified user."""
args = gpg_command(['--version']) args = gpg_command(['--version'])
output = sp.check_output(args).decode('ascii') output = sp.check_output(args)
line = output.split(b'\n')[0] # b'gpg (GnuPG) 2.1.11' line = output.split(b'\n')[0] # b'gpg (GnuPG) 2.1.11'
return line.split(b' ')[-1] # b'2.1.11' return line.split(b' ')[-1] # b'2.1.11'

Loading…
Cancel
Save