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 """
|
""" Check python version """
|
||||||
if impl == 'python':
|
if impl == 'python':
|
||||||
version_info = _sys.version_info
|
version_info = _sys.version_info
|
||||||
elif impl == 'pypy':
|
elif impl == 'pypy3':
|
||||||
version_info = getattr(_sys, 'pypy_version_info', None)
|
version_info = getattr(_sys, 'pypy_version_info', None)
|
||||||
if not version_info:
|
if not version_info:
|
||||||
return
|
return
|
||||||
|
@ -50,7 +50,7 @@ def check_python_version(impl, version_min, version_max):
|
||||||
return
|
return
|
||||||
version_info = _sys.version_info
|
version_info = _sys.version_info
|
||||||
else:
|
else:
|
||||||
raise AssertionError("impl not in ('python', 'pypy', 'jython')")
|
raise AssertionError("impl not in ('python', 'pypy3', 'jython')")
|
||||||
|
|
||||||
pyversion = list(map(int, version_info[:3]))
|
pyversion = list(map(int, version_info[:3]))
|
||||||
if version_min:
|
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_min = pkg.get('python.min') or None
|
||||||
python_max = pkg.get('python.max') or None
|
python_max = pkg.get('python.max') or None
|
||||||
check_python_version('python', python_min, python_max)
|
check_python_version('python', python_min, python_max)
|
||||||
pypy_min = pkg.get('pypy.min') or None
|
pypy_min = pkg.get('pypy3.min') or None
|
||||||
pypy_max = pkg.get('pypy.max') or None
|
pypy_max = pkg.get('pypy3.max') or None
|
||||||
check_python_version('pypy', pypy_min, pypy_max)
|
check_python_version('pypy3', pypy_min, pypy_max)
|
||||||
jython_min = pkg.get('jython.min') or None
|
jython_min = pkg.get('jython.min') or None
|
||||||
jython_max = pkg.get('jython.max') or None
|
jython_max = pkg.get('jython.max') or None
|
||||||
check_python_version('jython', jython_min, jython_max)
|
check_python_version('jython', jython_min, jython_max)
|
||||||
|
|
|
@ -50,21 +50,28 @@ class _INFO(dict):
|
||||||
except (TypeError, _curses.error):
|
except (TypeError, _curses.error):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
_curses.tigetstr('sgr0')
|
||||||
|
except TypeError: # pypy3
|
||||||
|
bc = lambda val: val.encode('ascii')
|
||||||
|
else:
|
||||||
|
bc = lambda val: val
|
||||||
|
|
||||||
def make_color(color):
|
def make_color(color):
|
||||||
""" Make color control string """
|
""" Make color control string """
|
||||||
seq = _curses.tigetstr('setaf').decode('ascii')
|
seq = _curses.tigetstr(bc('setaf')).decode('ascii')
|
||||||
if seq is not None:
|
if seq is not None:
|
||||||
# XXX may fail - need better logic
|
# XXX may fail - need better logic
|
||||||
seq = seq.replace("%p1", "") % color
|
seq = seq.replace("%p1", "") % color
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
self['NORMAL'] = _curses.tigetstr('sgr0').decode('ascii')
|
self['NORMAL'] = _curses.tigetstr(bc('sgr0')).decode('ascii')
|
||||||
self['BOLD'] = _curses.tigetstr('bold').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:
|
if erase is not None:
|
||||||
self['ERASE'] = erase + \
|
self['ERASE'] = erase + \
|
||||||
_curses.tigetstr('cr').decode('ascii')
|
_curses.tigetstr(bc('cr')).decode('ascii')
|
||||||
|
|
||||||
self['RED'] = make_color(_curses.COLOR_RED)
|
self['RED'] = make_color(_curses.COLOR_RED)
|
||||||
self['YELLOW'] = make_color(_curses.COLOR_YELLOW)
|
self['YELLOW'] = make_color(_curses.COLOR_YELLOW)
|
||||||
|
|
Loading…
Reference in New Issue