mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +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:
|
except ImportError:
|
||||||
from .util.helper import cmp_to_key
|
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:
|
try:
|
||||||
# python 2.6 and python 2.7
|
# 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)
|
filter_role(res, user, role)
|
||||||
return res
|
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):
|
def run_external(filename, *args, **kwargs):
|
||||||
"""Executes the program filename via subprocess.call.
|
"""Executes the program filename via subprocess.call.
|
||||||
|
|
||||||
|
@ -66,4 +66,19 @@ def decode_it(obj):
|
|||||||
return obj.decode(locale.getlocale()[1])
|
return obj.decode(locale.getlocale()[1])
|
||||||
except:
|
except:
|
||||||
return obj.decode('latin-1')
|
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