mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-28 09:40:07 -04:00
Merge pull request #2984 from enkore/issue/2976-1.0
1.0 backport #2980 keymanager: don't depend on optional readline module
This commit is contained in:
commit
226062b9c8
1 changed files with 9 additions and 6 deletions
|
|
@ -150,8 +150,11 @@ class KeyManager:
|
|||
self.store_keyblob(args)
|
||||
|
||||
def import_paperkey(self, args):
|
||||
# imported here because it has global side effects
|
||||
import readline
|
||||
try:
|
||||
# imported here because it has global side effects
|
||||
import readline
|
||||
except ImportError:
|
||||
print('Note: No line editing available due to missing readline support')
|
||||
|
||||
repoid = bin_to_hex(self.repository.id)[:18]
|
||||
try:
|
||||
|
|
@ -159,8 +162,8 @@ class KeyManager:
|
|||
# id line input
|
||||
while True:
|
||||
idline = input('id: ').replace(' ', '')
|
||||
if idline == "":
|
||||
if yes("Abort import? [yN]:"):
|
||||
if idline == '':
|
||||
if yes('Abort import? [yN]:'):
|
||||
raise EOFError()
|
||||
|
||||
try:
|
||||
|
|
@ -192,8 +195,8 @@ class KeyManager:
|
|||
while True:
|
||||
inline = input('{0:2d}: '.format(idx))
|
||||
inline = inline.replace(' ', '')
|
||||
if inline == "":
|
||||
if yes("Abort import? [yN]:"):
|
||||
if inline == '':
|
||||
if yes('Abort import? [yN]:'):
|
||||
raise EOFError()
|
||||
try:
|
||||
(data, checksum) = inline.split('-')
|
||||
|
|
|
|||
Loading…
Reference in a new issue