1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

move raw_input function to helper module

This commit is contained in:
lethliel 2019-08-27 15:07:41 +02:00
parent 7c01399a4a
commit c9d85ac248
2 changed files with 17 additions and 17 deletions

View File

@ -55,7 +55,7 @@ try:
except ImportError:
from .util.helper import cmp_to_key
from osc.util.helper import decode_list, decode_it
from osc.util.helper import decode_list, decode_it, raw_input
try:
# python 2.6 and python 2.7
@ -7683,21 +7683,6 @@ def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, p
filter_role(res, user, role)
return res
def raw_input(*args):
try:
import builtins
func = builtins.input
except ImportError:
#python 2.7
import __builtin__
func = __builtin__.raw_input
try:
return func(*args)
except EOFError:
# interpret ctrl-d as user abort
raise oscerr.UserAbort()
def run_external(filename, *args, **kwargs):
"""Executes the program filename via subprocess.call.

View File

@ -66,4 +66,19 @@ def decode_it(obj):
return obj.decode(locale.getlocale()[1])
except:
return obj.decode('latin-1')
def raw_input(*args):
try:
import builtins
func = builtins.input
except ImportError:
#python 2.7
import __builtin__
func = __builtin__.raw_input
try:
return func(*args)
except EOFError:
# interpret ctrl-d as user abort
raise oscerr.UserAbort()