[pypy-commit] pypy default: improve dotviewer search for system cpython

bdkearns noreply at buildbot.pypy.org
Mon Mar 11 05:14:44 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r62286:05243549ef64
Date: 2013-03-11 00:07 -0400
http://bitbucket.org/pypy/pypy/changeset/05243549ef64/

Log:	improve dotviewer search for system cpython

diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py
--- a/dotviewer/graphclient.py
+++ b/dotviewer/graphclient.py
@@ -130,10 +130,10 @@
     if hasattr(sys, 'pypy_objspaceclass'):
         # if 'python' is actually PyPy, e.g. in a virtualenv, then
         # try hard to find a real CPython
-        for python in ['/usr/local/bin/python', '/usr/bin/python']:
-            if os.path.exists(python):
-                break
-        else:
+        try:
+            python = subprocess.check_output(['env', '-i', 'which', 'python'])
+            python = python.strip()
+        except subprocess.CalledProcessError:
             # did not work, fall back to 'python'
             python = 'python'
     else:


More information about the pypy-commit mailing list