Author: Edd Barrett <[email protected]>
Branch: argparse-collect
Changeset: r245:96c76bb088d6
Date: 2013-09-05 13:33 +0100
http://bitbucket.org/pypy/jitviewer/changeset/96c76bb088d6/
Log: Remove existing check for pypy as it is now checked earlier.
diff --git a/_jitviewer/app.py b/_jitviewer/app.py
--- a/_jitviewer/app.py
+++ b/_jitviewer/app.py
@@ -1,4 +1,5 @@
#!/usr/bin/env pypy
+from _jitviewer.misc import failout
DESCR = """Jit Viewer: A web-based browser for PyPy log files"""
@@ -221,10 +222,6 @@
return os.path.abspath(path)
def main(argv, run_app=True):
- if not '__pypy__' in sys.builtin_module_names:
- print "Please run it using pypy-c"
- sys.exit(1)
-
parser = argparse.ArgumentParser(
description = DESCR,
epilog = EPILOG,
diff --git a/_jitviewer/misc.py b/_jitviewer/misc.py
new file mode 100644
--- /dev/null
+++ b/_jitviewer/misc.py
@@ -0,0 +1,5 @@
+import sys
+
+def failout(msg, exit_status = 1):
+ print("error: %s" % (msg, ))
+ sys.exit(exit_status)
diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -6,10 +6,10 @@
pythonpath = os.path.dirname(os.path.dirname(script_path))
sys.path.append(pythonpath)
-# Check we are running with PyPy
-if "pypy" not in os.path.basename(sys.executable):
- print("error: jitviewer must be run with PyPy")
- sys.exit(1)
+# Check we are running with PyPy first.
+if not '__pypy__' in sys.builtin_module_names:
+ from _jitviewer.misc import failout
+ failout("jitviewer must be run with PyPy")
from _jitviewer.app import main
main(sys.argv)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit