[pypy-svn] r17946 - in pypy/dist/pypy/translator/tool: . test

pedronis at codespeak.net pedronis at codespeak.net
Wed Sep 28 19:55:34 CEST 2005


Author: pedronis
Date: Wed Sep 28 19:55:31 2005
New Revision: 17946

Modified:
   pypy/dist/pypy/translator/tool/taskengine.py
   pypy/dist/pypy/translator/tool/test/test_taskengine.py
Log:
added helper to find strong dependecies from a task



Modified: pypy/dist/pypy/translator/tool/taskengine.py
==============================================================================
--- pypy/dist/pypy/translator/tool/taskengine.py	(original)
+++ pypy/dist/pypy/translator/tool/taskengine.py	Wed Sep 28 19:55:31 2005
@@ -80,6 +80,13 @@
 
         return plan
 
+    def _depending_on(self, goal):
+        l = []
+        for task_name, (task, task_deps) in self.tasks.iteritems():
+            if goal in task_deps:
+                l.append(task_name)
+        return l
+
     def _execute(self, goals, *args, **kwds):
         task_skip = kwds.get('task_skip', [])
         for goal in self._plan(goals, skip=task_skip):
@@ -104,27 +111,5 @@
         pass
 
 
-""" sketch of tasks for translation:
-
-annotate:  # includes annotation and annotatation simplifications
-
-rtype: annotate
-
-backendoptimisations: rtype # make little sense otherwise
-
-source_llvm: backendoptimisations, rtype, annotate
-
-source_c: ?backendoptimisations, ?rtype, ?annotate
-
-compile_c : source_c
-
-compile_llvm: source_llvm
-
-run_c: compile_c
-
-run_llvm: compile_llvm
-
-"""
-
         
         

Modified: pypy/dist/pypy/translator/tool/test/test_taskengine.py
==============================================================================
--- pypy/dist/pypy/translator/tool/test/test_taskengine.py	(original)
+++ pypy/dist/pypy/translator/tool/test/test_taskengine.py	Wed Sep 28 19:55:31 2005
@@ -23,6 +23,10 @@
     assert abc._plan('C') == ['B', 'C']
     assert abc._plan('A') == ['B', 'C', 'A']
     assert abc._plan('A', skip=['C']) == ['B', 'A']
+
+    assert abc._depending_on('C') == []
+    assert dict.fromkeys(abc._depending_on('B'), True) == {'A':True, 'C':True}
+    assert abc._depending_on('A') == []
    
 def test_execute():
 



More information about the Pypy-commit mailing list