[pypy-svn] rev 2015 - in pypy/trunk/src/pypy/translator: . test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Tue Oct 21 11:59:34 CEST 2003


Author: sanxiyn
Date: Tue Oct 21 11:59:33 2003
New Revision: 2015

Added:
   pypy/trunk/src/pypy/translator/test/cmuclinvoke.sh
Modified:
   pypy/trunk/src/pypy/translator/peepfgt.py   (props changed)
   pypy/trunk/src/pypy/translator/test/benchmark.py   (props changed)
   pypy/trunk/src/pypy/translator/test/test_cltrans.py
Log:
benchmark, peepfgt: fixeol :-)

Refined CL detection. PYPY_CL is tried, and then
'which' command is tried with os.system. (If it
doesn't exist it will always fail, so no problem.)

CMU CL is detected, and cmuclinvoke script will
be used. Copy it to your PATH and make it executable.


Added: pypy/trunk/src/pypy/translator/test/cmuclinvoke.sh
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/translator/test/cmuclinvoke.sh	Tue Oct 21 11:59:33 2003
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Copy this to your PATH
+lisp -batch -eval "(compile-file \"$1\")(quit)" >/dev/null 2>&1
+lisp -batch -quiet -eval "(load (compile-file-pathname \"$1\"))(quit)"

Modified: pypy/trunk/src/pypy/translator/test/test_cltrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_cltrans.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_cltrans.py	Tue Oct 21 11:59:33 2003
@@ -12,12 +12,25 @@
         if cl:
             self.cl = cl
         else:
-            try:
-                out = exec_cmd('clisp --version')
-            except ExecutionFailed:
-                raise test.TestSkip, "no list interpreter configured and no 'clisp' found"
+            cl = self.cl_detect()
+            if cl:
+                self.cl = cl
             else:
-                self.cl = 'clisp'
+                raise (test.TestSkip,
+                       "Common Lisp neither configured nor detected.")
+
+    def cl_detect(self):
+        import os
+        if self.is_on_path("clisp"):
+            return "clisp"
+        elif self.is_on_path("lisp"):
+            if self.is_on_path("cmuclinvoke.sh"):
+                return "cmuclinvoke.sh"
+        return None
+
+    def is_on_path(self, name):
+        import os
+        return os.system("which %s >/dev/null" % name) == 0
 
     def cl_func(self, func):
         return make_cl_func(func, self.cl, udir)


More information about the Pypy-commit mailing list