mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-04 02:26:16 +01:00
python3 compatibility: raw_input
raw_input has been removed and equals to input in py3. Unfortunatelly no __future__ statement exists for that. Ensure all modules uses osc.core.raw_input except osc.cmdln, where there is NameError way implemented.
This commit is contained in:
parent
b534ae0a6a
commit
5cc72902e0
@ -17,7 +17,7 @@ except ImportError:
|
||||
from tempfile import NamedTemporaryFile, mkdtemp
|
||||
from osc.fetch import *
|
||||
from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir
|
||||
from osc.core import get_binarylist, get_binary_file, run_external
|
||||
from osc.core import get_binarylist, get_binary_file, run_external, raw_input
|
||||
from osc.util import rpmquery, debquery, archquery
|
||||
import osc.conf
|
||||
from . import oscerr
|
||||
|
@ -405,7 +405,11 @@ class RawCmdln(cmd.Cmd):
|
||||
else:
|
||||
if self.use_rawinput:
|
||||
try:
|
||||
line = raw_input(self._prompt_str)
|
||||
try:
|
||||
#python 2.x
|
||||
line = raw_input(self._prompt_str)
|
||||
except NameError:
|
||||
line = input(self._prompt_str)
|
||||
except EOFError:
|
||||
line = 'EOF'
|
||||
else:
|
||||
|
@ -6554,12 +6554,14 @@ def get_user_projpkgs(apiurl, user, role=None, exclude_projects=[], proj=True, p
|
||||
def raw_input(*args):
|
||||
try:
|
||||
import builtins
|
||||
func = builtins.input
|
||||
except ImportError:
|
||||
#python 2.7
|
||||
import __builtin__ as builtins
|
||||
import __builtin__
|
||||
func = __builtin__.raw_input
|
||||
|
||||
try:
|
||||
return builtins.raw_input(*args)
|
||||
return func(*args)
|
||||
except EOFError:
|
||||
# interpret ctrl-d as user abort
|
||||
raise oscerr.UserAbort()
|
||||
|
@ -21,6 +21,8 @@ except ImportError:
|
||||
from urlparse import urlparse
|
||||
from httplib import HTTPSConnection
|
||||
|
||||
from .core import raw_input
|
||||
|
||||
class TrustedCertStore:
|
||||
_tmptrusted = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user