projects
/
crypto-install.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e915505
)
Python 3 string compatibility.
author
Olof-Joachim Frahm
<olof@macrolet.net>
Wed, 14 Jan 2015 22:14:06 +0000
(22:14 +0000)
committer
Olof-Joachim Frahm
<olof@macrolet.net>
Wed, 14 Jan 2015 22:15:23 +0000
(22:15 +0000)
crypto-install.py
patch
|
blob
|
history
diff --git
a/crypto-install.py
b/crypto-install.py
index
c5fe7db
..
2e7e7cb
100755
(executable)
--- a/
crypto-install.py
+++ b/
crypto-install.py
@@
-178,13
+178,13
@@
def input_passphrase (arguments):
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
env = batch_env)
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
env = batch_env)
- (stdout, stderr) = passphrase_process.communicate (batch_passphrase)
+ (stdout, stderr) = passphrase_process.communicate (batch_passphrase.encode ("UTF-8"))
if passphrase_process.returncode != 0:
raise Exception ("Couldn't read passphrase.")
for line in stdout.splitlines ():
if passphrase_process.returncode != 0:
raise Exception ("Couldn't read passphrase.")
for line in stdout.splitlines ():
- if line.startswith ("D "):
+ if line.decode ("UTF-8").startswith ("D "):
return line[2:]
return ""
return line[2:]
return ""
@@
-234,7
+234,7
@@
def gnupg_setup (arguments, name = None, email = None, comment = None):
if comment != "":
batch_key += "Name-Comment: {}\n".format (comment)
if comment != "":
batch_key += "Name-Comment: {}\n".format (comment)
- tmp.write (batch_key)
+ tmp.write (batch_key.encode ("UTF-8"))
tmp.flush ()
batch_env = dict (os.environ)
tmp.flush ()
batch_env = dict (os.environ)
@@
-256,9
+256,9
@@
def gnupg_setup (arguments, name = None, email = None, comment = None):
while True:
line = gnupg_process.stdout.readline ()
while True:
line = gnupg_process.stdout.readline ()
- if line == "":
+ if len (line) == 0:
break
break
- sys.stdout.write (line)
+ sys.stdout.write (line.decode ("UTF-8"))
if gnupg_process.returncode != 0:
raise Exception ("Couldn't create GnuPG key.")
if gnupg_process.returncode != 0:
raise Exception ("Couldn't create GnuPG key.")
@@
-322,9
+322,9
@@
def openssh_setup (arguments, comment = None):
while True:
line = openssh_process.stdout.readline ()
while True:
line = openssh_process.stdout.readline ()
- if line == "":
+ if len (line) == 0:
break
break
- sys.stdout.write (line)
+ sys.stdout.write (line.decode ("UTF-8"))
if openssh_process.returncode != 0:
raise Exception ("Couldn't create OpenSSH key.")
if openssh_process.returncode != 0:
raise Exception ("Couldn't create OpenSSH key.")