[pypy-commit] pypy default: Improve a bit issue #1412: dotviewer python path

arigo noreply at buildbot.pypy.org
Sun Mar 10 12:43:24 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r62274:a37006b7fffa
Date: 2013-03-10 12:43 +0100
http://bitbucket.org/pypy/pypy/changeset/a37006b7fffa/

Log:	Improve a bit issue #1412: dotviewer python path

diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py
--- a/dotviewer/graphclient.py
+++ b/dotviewer/graphclient.py
@@ -128,7 +128,14 @@
 
 def spawn_local_handler():
     if hasattr(sys, 'pypy_objspaceclass'):
-        python = '/usr/bin/python'
+        # 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:
+            # did not work, fall back to 'python'
+            python = 'python'
     else:
         python = sys.executable
     args = [python, '-u', GRAPHSERVER, '--stdio']


More information about the pypy-commit mailing list