[pypy-svn] r78742 - in pypy/branch/fast-forward/pypy/module/sys: . test

afa at codespeak.net afa at codespeak.net
Fri Nov 5 15:07:02 CET 2010


Author: afa
Date: Fri Nov  5 15:06:58 2010
New Revision: 78742

Modified:
   pypy/branch/fast-forward/pypy/module/sys/test/test_version.py
   pypy/branch/fast-forward/pypy/module/sys/version.py
Log:
Add compiler info in sys.version.
This should help distutils on Windows.


Modified: pypy/branch/fast-forward/pypy/module/sys/test/test_version.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/sys/test/test_version.py	(original)
+++ pypy/branch/fast-forward/pypy/module/sys/test/test_version.py	Fri Nov  5 15:06:58 2010
@@ -3,3 +3,9 @@
 def test_rev2int():
     assert rev2int("71630") == 71630
     assert rev2int("") == 0
+
+class AppTestVersion:
+    def test_compiler(self):
+        import sys
+        assert ("MSC v." in sys.version or
+                "GCC " in sys.version)

Modified: pypy/branch/fast-forward/pypy/module/sys/version.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/sys/version.py	(original)
+++ pypy/branch/fast-forward/pypy/module/sys/version.py	Fri Nov  5 15:06:58 2010
@@ -2,7 +2,7 @@
 Version numbers exposed by PyPy through the 'sys' module.
 """
 import os
-
+from pypy.translator.platform import platform
 
 #XXX # the release serial 42 is not in range(16)
 CPYTHON_VERSION            = (2, 7, 0, "final", 42)   #XXX # sync patchlevel.h
@@ -16,6 +16,11 @@
 
 REV = """$LastChangedRevision$"""[22:-2]
 
+if platform.name == 'msvc':
+    COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600)
+else:
+    COMPILER_INFO = ""
+
 def rev2int(rev):
     try:
         return int(rev)
@@ -48,7 +53,7 @@
     return space.wrap(CPYTHON_VERSION)
 
 def get_version(space):
-    return space.wrap("%d.%d.%d (%d, %s, %s)\n[PyPy %d.%d.%d]" % (
+    return space.wrap("%d.%d.%d (%d, %s, %s)\n[PyPy %d.%d.%d%s]" % (
         CPYTHON_VERSION[0],
         CPYTHON_VERSION[1],
         CPYTHON_VERSION[2],
@@ -57,7 +62,8 @@
         time,
         PYPY_VERSION[0],
         PYPY_VERSION[1],
-        PYPY_VERSION[2]))
+        PYPY_VERSION[2],
+        compiler_version()))
 
 def get_winver(space):
     return space.wrap("%d.%d" % (
@@ -134,3 +140,8 @@
     except (IOError, OSError):
         pass
     return rev
+
+def compiler_version():
+    if not COMPILER_INFO:
+        return ""
+    return " with %s" % (COMPILER_INFO,)



More information about the Pypy-commit mailing list