[pypy-svn] r44589 - in pypy/dist/pypy/translator: . goal test

pedronis at codespeak.net pedronis at codespeak.net
Thu Jun 28 11:17:01 CEST 2007


Author: pedronis
Date: Thu Jun 28 11:17:01 2007
New Revision: 44589

Modified:
   pypy/dist/pypy/translator/driver.py
   pypy/dist/pypy/translator/goal/targetnopstandalone.py
   pypy/dist/pypy/translator/test/test_driver.py
Log:
revert new implicit way of doing things



Modified: pypy/dist/pypy/translator/driver.py
==============================================================================
--- pypy/dist/pypy/translator/driver.py	(original)
+++ pypy/dist/pypy/translator/driver.py	Thu Jun 28 11:17:01 2007
@@ -753,16 +753,9 @@
         if backend == 'cli':
             from pypy.translator.cli.support import patch
             driver.old_cli_defs = patch()
-
-        if 'target' in targetspec_dic:
-            target = targetspec_dic['target']
-            spec = target(driver, args)
-        else:
-            try:
-                entry_point = targetspec_dic['entry_point']
-            except KeyError:
-                raise ValueError("Target spec doesn't seem to have target nor entry_point")
-            spec = entry_point, None
+        
+        target = targetspec_dic['target']
+        spec = target(driver, args)
 
         try:
             entry_point, inputtypes, policy = spec

Modified: pypy/dist/pypy/translator/goal/targetnopstandalone.py
==============================================================================
--- pypy/dist/pypy/translator/goal/targetnopstandalone.py	(original)
+++ pypy/dist/pypy/translator/goal/targetnopstandalone.py	Thu Jun 28 11:17:01 2007
@@ -17,3 +17,8 @@
 def entry_point(argv):
     debug("hello world")
     return 0
+
+# _____ Define and setup target ___
+
+def target(*args):
+    return entry_point, None

Modified: pypy/dist/pypy/translator/test/test_driver.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_driver.py	(original)
+++ pypy/dist/pypy/translator/test/test_driver.py	Thu Jun 28 11:17:01 2007
@@ -63,15 +63,3 @@
                 'run_c', 'prehannotatebackendopt', 'hintannotate', 'timeshift']
 
     assert cmpl(td.exposed, expected)
-
-def test_from_targetspecdic():
-    py.test.raises(ValueError, TranslationDriver.from_targetspec, {})
-    def f(argv):
-        return 0
-    driver = TranslationDriver.from_targetspec({'entry_point':f})
-    assert driver.entry_point is f
-    def target(driver, args):
-        return f, None
-    driver = TranslationDriver.from_targetspec({'target':target})
-    assert driver.entry_point is f
-



More information about the Pypy-commit mailing list