mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 17:57:59 +00:00
keymanager: don't depend on optional readline module
This commit is contained in:
parent
f7ed5d7220
commit
b8793d9577
1 changed files with 9 additions and 6 deletions
|
@ -142,8 +142,11 @@ def import_keyfile(self, args):
|
||||||
self.store_keyblob(args)
|
self.store_keyblob(args)
|
||||||
|
|
||||||
def import_paperkey(self, args):
|
def import_paperkey(self, args):
|
||||||
# imported here because it has global side effects
|
try:
|
||||||
import readline
|
# 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]
|
repoid = bin_to_hex(self.repository.id)[:18]
|
||||||
try:
|
try:
|
||||||
|
@ -151,8 +154,8 @@ def import_paperkey(self, args):
|
||||||
# id line input
|
# id line input
|
||||||
while True:
|
while True:
|
||||||
idline = input('id: ').replace(' ', '')
|
idline = input('id: ').replace(' ', '')
|
||||||
if idline == "":
|
if idline == '':
|
||||||
if yes("Abort import? [yN]:"):
|
if yes('Abort import? [yN]:'):
|
||||||
raise EOFError()
|
raise EOFError()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -184,8 +187,8 @@ def import_paperkey(self, args):
|
||||||
while True:
|
while True:
|
||||||
inline = input('{0:2d}: '.format(idx))
|
inline = input('{0:2d}: '.format(idx))
|
||||||
inline = inline.replace(' ', '')
|
inline = inline.replace(' ', '')
|
||||||
if inline == "":
|
if inline == '':
|
||||||
if yes("Abort import? [yN]:"):
|
if yes('Abort import? [yN]:'):
|
||||||
raise EOFError()
|
raise EOFError()
|
||||||
try:
|
try:
|
||||||
(data, checksum) = inline.split('-')
|
(data, checksum) = inline.split('-')
|
||||||
|
|
Loading…
Reference in a new issue