mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 10:16:14 +01:00
move raw_input function to helper module
This commit is contained in:
parent
7c01399a4a
commit
c9d85ac248
17
osc/core.py
17
osc/core.py
@ -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.
|
||||
|
||||
|
@ -67,3 +67,18 @@ def decode_it(obj):
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user