mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-09 16:01:28 +00:00
Use YesNoQuestion in pbuilder-dist
This commit is contained in:
parent
d4fbed617f
commit
054423d016
@ -37,6 +37,8 @@ from distro_info import DebianDistroInfo
|
|||||||
|
|
||||||
import ubuntutools.misc
|
import ubuntutools.misc
|
||||||
from ubuntutools import subprocess
|
from ubuntutools import subprocess
|
||||||
|
from ubuntutools.question import YesNoQuestion
|
||||||
|
|
||||||
|
|
||||||
class PbuilderDist:
|
class PbuilderDist:
|
||||||
def __init__(self, builder):
|
def __init__(self, builder):
|
||||||
@ -135,9 +137,10 @@ class PbuilderDist:
|
|||||||
# Debian experimental doesn't have a debootstrap file but
|
# Debian experimental doesn't have a debootstrap file but
|
||||||
# should work nevertheless.
|
# should work nevertheless.
|
||||||
if distro not in self._debian_distros:
|
if distro not in self._debian_distros:
|
||||||
answer = ask(('Warning: Unknown distribution "%s". Do you '
|
answer = YesNoQuestion().ask(
|
||||||
'want to continue [y/N]? ') % distro)
|
'Warning: Unknown distribution "%s". '
|
||||||
if answer not in ('y', 'Y'):
|
'Do you want to continue' % distro, 'no')
|
||||||
|
if answer == 'yes':
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
Logger.error('Please install package "debootstrap".')
|
Logger.error('Please install package "debootstrap".')
|
||||||
@ -297,22 +300,6 @@ class PbuilderDist:
|
|||||||
self.builder,
|
self.builder,
|
||||||
] + arguments
|
] + arguments
|
||||||
|
|
||||||
|
|
||||||
def ask(question):
|
|
||||||
""" ask(question) -> string
|
|
||||||
|
|
||||||
Ask the given question and return the answer. Also catch
|
|
||||||
KeyboardInterrupt (Ctrl+C) and EOFError (Ctrl+D) exceptions and
|
|
||||||
immediately return None if one of those is found.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
answer = raw_input(question)
|
|
||||||
except (KeyboardInterrupt, EOFError):
|
|
||||||
print
|
|
||||||
answer = None
|
|
||||||
|
|
||||||
return answer
|
|
||||||
|
|
||||||
def show_help(exit_code = 0):
|
def show_help(exit_code = 0):
|
||||||
""" help() -> None
|
""" help() -> None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user