mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
#8964: fix platform._sys_version to handle IronPython 2.6+.
This commit is contained in:
parent
c318442571
commit
f076f53386
4 changed files with 33 additions and 3 deletions
|
@ -1248,6 +1248,14 @@ _ironpython_sys_version_parser = re.compile(
|
|||
'(?: \(([\d\.]+)\))?'
|
||||
' on (.NET [\d\.]+)', re.ASCII)
|
||||
|
||||
# IronPython covering 2.6 and 2.7
|
||||
_ironpython26_sys_version_parser = re.compile(
|
||||
r'([\d.]+)\s*'
|
||||
'\(IronPython\s*'
|
||||
'[\d.]+\s*'
|
||||
'\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)'
|
||||
)
|
||||
|
||||
_pypy_sys_version_parser = re.compile(
|
||||
r'([\w.+]+)\s*'
|
||||
'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
|
||||
|
@ -1285,19 +1293,24 @@ def _sys_version(sys_version=None):
|
|||
return result
|
||||
|
||||
# Parse it
|
||||
if sys_version[:10] == 'IronPython':
|
||||
if 'IronPython' in sys_version:
|
||||
# IronPython
|
||||
name = 'IronPython'
|
||||
match = _ironpython_sys_version_parser.match(sys_version)
|
||||
if sys_version.startswith('IronPython'):
|
||||
match = _ironpython_sys_version_parser.match(sys_version)
|
||||
else:
|
||||
match = _ironpython26_sys_version_parser.match(sys_version)
|
||||
|
||||
if match is None:
|
||||
raise ValueError(
|
||||
'failed to parse IronPython sys.version: %s' %
|
||||
repr(sys_version))
|
||||
|
||||
version, alt_version, compiler = match.groups()
|
||||
buildno = ''
|
||||
builddate = ''
|
||||
|
||||
elif sys.platform[:4] == 'java':
|
||||
elif sys.platform.startswith('java'):
|
||||
# Jython
|
||||
name = 'Jython'
|
||||
match = _sys_version_parser.match(sys_version)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue