Commits

Anders Hammarquist committed 3fc7bdb Merge

Merge fix for recursive dependencies

Comments (0)

Files changed (2)

oejskit/modular.py

         if path in acc:
             return path
 
-        deps = []
+        acc[path] = deps = []
         for dep in self._parseDepsData(module, fp):
             p = self._simpleDeps(dep, fsRepos, acc)
-            if p:
+            if p and p != path:
                 deps.append(p)
 
-        acc[path] = deps
         return path
 
     def _fsRepos(self, repos):

test/test_modular.py

         os.mkdir(os.path.join(cls.test_dir, 'js', 'OpenEnd'))
         f = open(os.path.join(cls.test_dir, 'js', 'OpenEnd', 'Support.js'),
                  'w')
-        f.write('// dummy\n')
+        f.write('// recusive dependency\n')
+        f.write('OpenEnd.use("OpenEnd.Support")\n')
         f.close()
 
     @classmethod
         jsResolver = JsResolver()
 
         fsRepos = {os.path.join(weblibDir, 'mochikit'):
-                       ['lib', 'mochikit']}
+                       ['lib', 'mochikit'],
+                   self.jsDir: ['js']}
 
         acc = {}
         res = jsResolver._simpleDeps("Nonsense", fsRepos, acc)
         assert acc == {}
 
         acc = {}
+        res = jsResolver._simpleDeps("OpenEnd.Support", fsRepos, acc)
+        assert res == '/js/OpenEnd/Support.js'
+        assert acc == {
+            '/js/OpenEnd/Support.js' : []
+            }
+
+        acc = {}
         res = jsResolver._simpleDeps("MochiKit.Style", fsRepos, acc)
         assert res == "/lib/mochikit/MochiKit/Style.js"