File python3.patch of Package python-pass_python_keyring
From 0b49c548db332b6ffe14b7122a6e29bc3c94209f Mon Sep 17 00:00:00 2001
From: Theo Chatzimichos <tampakrap@gmail.com>
Date: Sun, 5 Aug 2018 13:51:02 +0200
Subject: [PATCH 1/2] remove whitespace
---
pass.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pass.py b/pass.py
index 21dc517..bdc4442 100755
--- a/pass.py
+++ b/pass.py
@@ -11,7 +11,7 @@
class Keyring(KeyringBackend):
"""Pass Keyring"""
- def supported(self):
+ def supported(self):
return 0
def get_password(self, service, username):
@@ -32,6 +32,6 @@ def set_password(self, service, username, password):
def delete_password(self, service, username):
proc = Popen(['pass', 'rm', '--force', '/'.join([service,username])])
- proc.wait()
+ proc.wait()
if(proc.returncode != 0):
raise PasswordDeleteError("Password not found")
From 08c90c10d78ba80bd6b92586fda5487bf2ad5cc2 Mon Sep 17 00:00:00 2001
From: Theo Chatzimichos <tampakrap@gmail.com>
Date: Sun, 5 Aug 2018 14:04:31 +0200
Subject: [PATCH 2/2] fix python3 TypeError on get_password
the password that is returned in the get_password method is not a
string, so when called a TypeError is raised:
`TypeError: a bytes-like object is required, not 'str'`
By decoding it to utf-8 it works on python3, without breaking
compatibility on python2
---
pass.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pass.py b/pass.py
index bdc4442..96e2cd8 100755
--- a/pass.py
+++ b/pass.py
@@ -20,7 +20,7 @@ def get_password(self, service, username):
password, _ = proc.communicate()
proc.wait()
if(proc.returncode == 0):
- return password.rstrip('\n')
+ return password.decode('utf-8').rstrip('\n')
else:
return None