[pypy-svn] jitviewer default: automatically add the correct directory to sys.path, so you can run jitviewer without installing it

antocuni commits-noreply at bitbucket.org
Tue Jan 25 14:04:19 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r79:a15e41b07c6b
Date: 2011-01-25 14:02 +0100
http://bitbucket.org/pypy/jitviewer/changeset/a15e41b07c6b/

Log:	automatically add the correct directory to sys.path, so you can run
	jitviewer without installing it

diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -9,7 +9,13 @@
 """
 
 import sys
-import os
+import os.path
+
+try:
+    import _jitviewer
+except ImportError:
+    sys.path.insert(0, os.path.abspath(os.path.join(__file__, '..', '..')))
+
 import cgi
 import flask
 import inspect


More information about the Pypy-commit mailing list