Skip to content

Commit

Permalink
migrate raw_input() to Python3 (RhBug:1208399)
Browse files Browse the repository at this point in the history
  • Loading branch information
xsuchy committed Apr 2, 2015
1 parent 4404c6a commit 2772c9e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/copr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
YES = set([_('yes'), _('y')])
NO = set([_('no'), _('n'), ''])

# compatibility with Py2 and Py3 - rename raw_input() to input() on Py2
try:
input = raw_input
except NameError:
pass

class Copr(dnf.Plugin):
"""DNF plugin supplying the 'copr' command."""
Expand Down Expand Up @@ -176,10 +181,10 @@ def _ask_user(self, question):
elif self.base.conf.assumeno and not self.base.conf.assumeyes:
raise dnf.exceptions.Error(_('Safe and good answer. Exiting.'))

answer = raw_input(question).lower()
answer = input(question).lower()
answer = _(answer)
while not ((answer in YES) or (answer in NO)):
answer = raw_input(question).lower()
answer = input(question).lower()
answer = _(answer)
if answer in YES:
return
Expand Down

0 comments on commit 2772c9e

Please sign in to comment.