[pypy-commit] pypy default: merge

fijal noreply at buildbot.pypy.org
Sat Oct 8 18:51:05 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r47881:abb1978e51e0
Date: 2011-10-08 18:50 +0200
http://bitbucket.org/pypy/pypy/changeset/abb1978e51e0/

Log:	merge

diff --git a/pypy/translator/c/genc.py b/pypy/translator/c/genc.py
--- a/pypy/translator/c/genc.py
+++ b/pypy/translator/c/genc.py
@@ -8,7 +8,7 @@
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rpython.lltypesystem import lltype
 from pypy.tool.udir import udir
-from pypy.tool import isolate
+from pypy.tool import isolate, runsubprocess
 from pypy.translator.c.support import log, c_string_constant
 from pypy.rpython.typesystem import getfunctionptr
 from pypy.translator.c import gc
@@ -563,14 +563,19 @@
             else:
                 mk.definition('PYPY_MAIN_FUNCTION', "main")
 
-            if (py.path.local.sysfind('python') or
-                py.path.local.sysfind('python.exe')):
-                python = 'python '
-            elif sys.platform == 'win32':
+            if sys.platform == 'win32':
                 python = sys.executable.replace('\\', '/') + ' '
             else:
                 python = sys.executable + ' '
 
+            # Is there a command 'python' that runs python 2.5-2.7?
+            # If there is, then we can use it instead of sys.executable
+            returncode, stdout, stderr = runsubprocess.run_subprocess(
+                "python", "-V")
+            if (stdout.startswith('Python 2.') or
+                stderr.startswith('Python 2.')):
+                python = 'python '
+
             if self.translator.platform.name == 'msvc':
                 lblofiles = []
                 for cfile in mk.cfiles:
diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py
--- a/pypy/translator/goal/app_main.py
+++ b/pypy/translator/goal/app_main.py
@@ -144,7 +144,7 @@
     print '  --jit off                  turn off the JIT'
 
 def print_version(*args):
-    print "Python", sys.version
+    print >> sys.stderr, "Python", sys.version
     raise SystemExit
 
 def set_jit_option(options, jitparam, *args):


More information about the pypy-commit mailing list