summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-10-21 00:03:32 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-10-21 00:03:32 (GMT)
commitf076f53386c422060517b8f088eadff3a80e48e6 (patch)
treebdd0895433e1e8d4e21220a39a683fcded4f96ad /Lib/platform.py
parentc31844257185f897d657bb8929f36f9c4e8888f2 (diff)
downloadcpython-f076f53386c422060517b8f088eadff3a80e48e6.zip
cpython-f076f53386c422060517b8f088eadff3a80e48e6.tar.gz
cpython-f076f53386c422060517b8f088eadff3a80e48e6.tar.bz2
#8964: fix platform._sys_version to handle IronPython 2.6+.
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index d5ebf25..ec5df85 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -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)