From b457b89323e3110159298bb5aa149f56733aaef8 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 26 Mar 2009 18:55:48 +0000 Subject: [PATCH] more and more implementations now support sys.subversion --- Lib/platform.py | 21 ++++++++------------- Lib/test/test_platform.py | 6 +++--- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Lib/platform.py b/Lib/platform.py index 2559798b535..7863821cceb 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1311,8 +1311,6 @@ def _sys_version(sys_version=None): 'failed to parse IronPython sys.version: %s' % repr(sys_version)) version, alt_version, compiler = match.groups() - branch = '' - revision = '' buildno = '' builddate = '' @@ -1325,11 +1323,7 @@ def _sys_version(sys_version=None): 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() - branch = '' - revision = '' compiler = sys.platform - buildno = '' - builddate = '' else: # CPython @@ -1340,15 +1334,16 @@ def _sys_version(sys_version=None): repr(sys_version)) version, buildno, builddate, buildtime, compiler = \ match.groups() - if hasattr(sys, 'subversion'): - # sys.subversion was added in Python 2.5 - name, branch, revision = sys.subversion - else: - name = 'CPython' - branch = '' - revision = '' + name = 'CPython' builddate = builddate + ' ' + buildtime + if hasattr(sys, 'subversion'): + # sys.subversion was added in Python 2.5 + _, branch, revision = sys.subversion + else: + branch = '' + revision = '' + # Add the patchlevel version if missing l = string.split(version, '.') if len(l) == 2: diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 342d7bc04b0..dc490ce31d5 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -73,10 +73,10 @@ class PlatformTest(unittest.TestCase): ("IronPython", "2.0.0", "", "", ("", ""), ".NET 2.0.50727.3053"), ("2.5 (trunk:6107, Mar 26 2009, 13:02:18) \n[Java HotSpot(TM) Client VM (\"Apple Computer, Inc.\")]", - None, "java1.5.0_16") + ('Jython', 'trunk', '6107'), "java1.5.0_16") : - ("Jython", "2.5.0", "", "", ("", ""), - "java1.5.0_16"), + ("Jython", "2.5.0", "trunk", "6107", + ('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"), } for (version_tag, subversion, sys_platform), info in \ sys_versions.iteritems():