add support for PyPy
This commit is contained in:
parent
94e4e2a7e5
commit
0ad9b7727d
|
@ -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)
|
||||
|
|
|
@ -93,6 +93,11 @@ class PlatformTest(unittest.TestCase):
|
|||
:
|
||||
("Jython", "2.5.0", "trunk", "6107",
|
||||
('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"),
|
||||
("2.5.2 (63378, Mar 26 2009, 18:03:29)\n[PyPy 1.0.0]",
|
||||
('PyPy', 'trunk', '63378'), self.save_platform)
|
||||
:
|
||||
("PyPy", "2.5.2", "trunk", "63378", ('63378', 'Mar 26 2009'),
|
||||
"")
|
||||
}
|
||||
for (version_tag, subversion, sys_platform), info in \
|
||||
sys_versions.iteritems():
|
||||
|
|
Loading…
Reference in New Issue