On 12/9/06, Anthony Baxter <[EMAIL PROTECTED]> wrote:
The following patch makes Lib/platform.py correctly parse the
sys.version string for FePy 1.0 and 1.0.1. It would be good if it
could be added to IPCE - then pybench will work.

Damn. diffed wrong version. Try this patch, instead. It's against the
version in CPython 2.5.


This works on each version of FePy I could find.
--- /usr/lib/python2.5/platform.py	2006-10-07 01:23:11.000000000 +1000
+++ platform.py	2006-12-09 18:52:30.000000000 +1100
@@ -1095,6 +1095,11 @@
 _sys_version_parser = re.compile(r'([\w.+]+)\s*'
                                   '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
                                   '\[([^\]]+)\]?')
+_ipy_sys_version_parser = re.compile(r'IronPython\s*'
+                                       '([\d\.]+)'
+                                       '( \(([\d\.]+)\))?'
+                                       ' on (.NET [\d\.]+)')
+
 _sys_version_cache = None
 
 def _sys_version():
@@ -1113,8 +1118,15 @@
 
     if _sys_version_cache is not None:
         return _sys_version_cache
-    version, buildno, builddate, buildtime, compiler = \
-             _sys_version_parser.match(sys.version).groups()
+    match = _sys_version_parser.match(sys.version)
+    if match:
+        version, buildno, builddate, buildtime, compiler = match.groups()
+    elif sys.version[:10] == "IronPython":
+        match = _ipy_sys_version_parser.match(sys.version)
+        version, dummy, rversion, compiler = match.groups()
+        if rversion: version = rversion
+        buildno = 0
+        builddate = buildtime = '?'
     builddate = builddate + ' ' + buildtime
     l = string.split(version, '.')
     if len(l) == 2:
_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to