add pypy3 support
This commit is contained in:
parent
14bcc97350
commit
c21140cf85
@ -41,7 +41,7 @@ def check_python_version(impl, version_min, version_max):
|
||||
""" Check python version """
|
||||
if impl == 'python':
|
||||
version_info = _sys.version_info
|
||||
elif impl == 'pypy':
|
||||
elif impl == 'pypy3':
|
||||
version_info = getattr(_sys, 'pypy_version_info', None)
|
||||
if not version_info:
|
||||
return
|
||||
@ -50,7 +50,7 @@ def check_python_version(impl, version_min, version_max):
|
||||
return
|
||||
version_info = _sys.version_info
|
||||
else:
|
||||
raise AssertionError("impl not in ('python', 'pypy', 'jython')")
|
||||
raise AssertionError("impl not in ('python', 'pypy3', 'jython')")
|
||||
|
||||
pyversion = list(map(int, version_info[:3]))
|
||||
if version_min:
|
||||
@ -344,9 +344,9 @@ def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
|
||||
python_min = pkg.get('python.min') or None
|
||||
python_max = pkg.get('python.max') or None
|
||||
check_python_version('python', python_min, python_max)
|
||||
pypy_min = pkg.get('pypy.min') or None
|
||||
pypy_max = pkg.get('pypy.max') or None
|
||||
check_python_version('pypy', pypy_min, pypy_max)
|
||||
pypy_min = pkg.get('pypy3.min') or None
|
||||
pypy_max = pkg.get('pypy3.max') or None
|
||||
check_python_version('pypy3', pypy_min, pypy_max)
|
||||
jython_min = pkg.get('jython.min') or None
|
||||
jython_max = pkg.get('jython.max') or None
|
||||
check_python_version('jython', jython_min, jython_max)
|
||||
|
@ -50,21 +50,28 @@ class _INFO(dict):
|
||||
except (TypeError, _curses.error):
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
_curses.tigetstr('sgr0')
|
||||
except TypeError: # pypy3
|
||||
bc = lambda val: val.encode('ascii')
|
||||
else:
|
||||
bc = lambda val: val
|
||||
|
||||
def make_color(color):
|
||||
""" Make color control string """
|
||||
seq = _curses.tigetstr('setaf').decode('ascii')
|
||||
seq = _curses.tigetstr(bc('setaf')).decode('ascii')
|
||||
if seq is not None:
|
||||
# XXX may fail - need better logic
|
||||
seq = seq.replace("%p1", "") % color
|
||||
return seq
|
||||
|
||||
self['NORMAL'] = _curses.tigetstr('sgr0').decode('ascii')
|
||||
self['BOLD'] = _curses.tigetstr('bold').decode('ascii')
|
||||
self['NORMAL'] = _curses.tigetstr(bc('sgr0')).decode('ascii')
|
||||
self['BOLD'] = _curses.tigetstr(bc('bold')).decode('ascii')
|
||||
|
||||
erase = _curses.tigetstr('el1').decode('ascii')
|
||||
erase = _curses.tigetstr(bc('el1')).decode('ascii')
|
||||
if erase is not None:
|
||||
self['ERASE'] = erase + \
|
||||
_curses.tigetstr('cr').decode('ascii')
|
||||
_curses.tigetstr(bc('cr')).decode('ascii')
|
||||
|
||||
self['RED'] = make_color(_curses.COLOR_RED)
|
||||
self['YELLOW'] = make_color(_curses.COLOR_YELLOW)
|
||||
|
Loading…
x
Reference in New Issue
Block a user