[pypy-svn] pypy commit 851fb55c6d49: Some quick fix of sys.version.

Bitbucket commits-noreply at bitbucket.org
Wed Dec 15 13:36:24 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pypy
# URL http://bitbucket.org/pypy/pypy/overview
# User Armin Rigo <arigo at tunes.org>
# Date 1292415869 -3600
# Node ID 851fb55c6d49c8c84ce52c3a5e12b081c1f07eb8
# Parent  4481ab58c417341ea2411151c5094b671a3cb2a2
Some quick fix of sys.version.

--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -8,8 +8,7 @@ import os
 CPYTHON_VERSION            = (2, 5, 2, "beta", 42)   #XXX # sync patchlevel.h
 CPYTHON_API_VERSION        = 1012   #XXX # sync with include/modsupport.h
 
-PYPY_VERSION               = (1, 4, 0, "beta", '?')  #XXX # sync patchlevel.h
-# the last item is replaced by the svn revision ^^^
+PYPY_VERSION               = (1, 4, 0, "beta", 0)    #XXX # sync patchlevel.h
 
 TRIM_URL_UP_TO = 'svn/pypy/'
 SVN_URL = """$HeadURL$"""[10:-28]
@@ -49,11 +48,11 @@ def get_version_info(space):
     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 (%s, %s, %s)\n[PyPy %d.%d.%d]" % (
         CPYTHON_VERSION[0],
         CPYTHON_VERSION[1],
         CPYTHON_VERSION[2],
-        svn_revision(),
+        hg_universal_id(),
         date,
         time,
         PYPY_VERSION[0],
@@ -70,7 +69,7 @@ def get_hexversion(space):
 
 def get_pypy_version_info(space):
     ver = PYPY_VERSION
-    ver = ver[:-1] + (svn_revision(),)
+    #ver = ver[:-1] + (svn_revision(),)
     return space.wrap(ver)
 
 def get_svn_url(space):
@@ -96,6 +95,13 @@ def wrap_mercurial_info(space):
     else:
         return space.w_None
 
+def hg_universal_id():
+    info = get_mercurial_info()
+    if info:
+        return info[2]
+    else:
+        return '?'
+
 
 def tuple2hex(ver):
     d = {'alpha':     0xA,

--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -471,6 +471,9 @@ class AppTestSysModulePortedFromCPython:
         # the id is either nothing, or an id of 12 hash digits, with a possible
         # suffix of '+' if there are local modifications
         assert hgid == '' or re.match('[0-9a-f]{12}\+?', hgid)
+        # the id should also show up in sys.version
+        if hgid != '':
+            assert hgid in sys.version
 
     def test_trace_exec_execfile(self):
         found = []



More information about the Pypy-commit mailing list