diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-10-21 00:05:46 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-10-21 00:05:46 (GMT) |
commit | 5c16c2eb457f9bba8bf04e11cf77a3de5035a178 (patch) | |
tree | 41f8deb85edeb7523380cd36962655cf98e077c8 /Lib/platform.py | |
parent | 632f1bfd3902e0b020ba697cdb7b31df7b2656d6 (diff) | |
parent | f076f53386c422060517b8f088eadff3a80e48e6 (diff) | |
download | cpython-5c16c2eb457f9bba8bf04e11cf77a3de5035a178.zip cpython-5c16c2eb457f9bba8bf04e11cf77a3de5035a178.tar.gz cpython-5c16c2eb457f9bba8bf04e11cf77a3de5035a178.tar.bz2 |
#8964: merge with 3.3.
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-x | Lib/platform.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index cbbe6d8..c3c4b32 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1183,6 +1183,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*' @@ -1220,19 +1228,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) |