mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
add support for PyPy
This commit is contained in:
parent
94e4e2a7e5
commit
0ad9b7727d
2 changed files with 20 additions and 0 deletions
|
|
@ -1270,6 +1270,11 @@ _ironpython_sys_version_parser = re.compile(
|
|||
'(?: \(([\d\.]+)\))?'
|
||||
' on (.NET [\d\.]+)')
|
||||
|
||||
_pypy_sys_version_parser = re.compile(
|
||||
r'([\w.+]+)\s*'
|
||||
'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
|
||||
'\[PyPy [^\]]+\]?')
|
||||
|
||||
_sys_version_cache = {}
|
||||
|
||||
def _sys_version(sys_version=None):
|
||||
|
|
@ -1325,6 +1330,16 @@ def _sys_version(sys_version=None):
|
|||
version, buildno, builddate, buildtime, _ = match.groups()
|
||||
compiler = sys.platform
|
||||
|
||||
elif "PyPy" in sys_version:
|
||||
# PyPy
|
||||
name = "PyPy"
|
||||
match = _pypy_sys_version_parser.match(sys_version)
|
||||
if match is None:
|
||||
raise ValueError("failed to parse PyPy sys.version: %s" %
|
||||
repr(sys_version))
|
||||
version, buildno, builddate, buildtime = match.groups()
|
||||
compiler = ""
|
||||
|
||||
else:
|
||||
# CPython
|
||||
match = _sys_version_parser.match(sys_version)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue