Skip to content

Commit be64726

Browse files
committed
Fix for Python 3.9
1 parent a7c70bb commit be64726

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: python
2-
python: 2.7
2+
python: 3.9
33

44
sudo: required
55

keyctl/key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# -*- coding: utf-8 -*-
33

4-
from keyctlwrapper import KeyctlWrapper
4+
from .keyctlwrapper import KeyctlWrapper
55

66

77
# -------------------------------------------------------------------

keyctl/keyctlwrapper.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,23 @@ class KeyctlWrapper(object):
5050
default_keyring = '@u'
5151
default_keytype = 'user'
5252

53-
def __init__(self, keyring=default_keyring, keytype=default_keytype):
53+
def __init__(self, keyring: str=default_keyring, keytype: str=default_keytype):
5454
self.keyring = keyring
5555
self.keytype = keytype
5656

5757
# ---------------------------------------------------------------
5858

5959
@staticmethod
60-
def _system(args, data=None, check=True):
60+
def _system(args, data: str=None, check=True):
61+
6162
try:
6263
p = subprocess.Popen(
6364
args,
6465
stdout=subprocess.PIPE,
6566
stderr=subprocess.PIPE,
6667
stdin=subprocess.PIPE,
67-
bufsize=4096
68+
bufsize=4096,
69+
text=True,
6870
)
6971
except OSError as e:
7072
raise OSError('Command \'{}\' execution failed. ErrMsg:{}'.format(' '.join(args), e))
@@ -78,7 +80,7 @@ def _system(args, data=None, check=True):
7880

7981
if not check:
8082
return ret, out, err
81-
elif ret is 0:
83+
elif ret == 0:
8284
return out
8385
else:
8486
raise KeyctlOperationError(errmsg='({}){} {}'.format(ret, err, out))

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
readme = readme.replace('\r', '')
1414
except ImportError:
1515
readme = 'see README.md'
16-
print 'NO README CREATED'
16+
print('NO README CREATED')
1717

1818

1919
setup(
@@ -40,7 +40,7 @@
4040
'Intended Audience :: Developers',
4141
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
4242
'Programming Language :: Python',
43-
'Programming Language :: Python :: 2.7',
43+
'Programming Language :: Python :: 3.9',
4444
'Environment :: X11 Applications :: Qt',
4545
'Topic :: Utilities',
4646
]

tests/test_keyctlwrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_get_data_from_id(self, empty_keyring):
111111

112112
# hex mode
113113
data = keyctl.get_data_from_id(keyid, 'hEx')
114-
assert data == content.encode('hex')
114+
assert data == content.encode("utf8").hex()
115115

116116
# ---------------------------------------------------------------
117117

0 commit comments

Comments
 (0)