[Checkins] SVN: z3c.recipe.autoinclude/ fixed dependency order

Nikolay Kim fafhrd91 at gmail.com
Mon Jan 18 12:27:47 EST 2010


Log message for revision 108210:
  fixed dependency order

Changed:
  U   z3c.recipe.autoinclude/branches/0.2.2dev/CHANGES.txt
  U   z3c.recipe.autoinclude/branches/0.2.2dev/setup.py
  U   z3c.recipe.autoinclude/branches/0.2.2dev/src/z3c/recipe/autoinclude/dependency.py
  U   z3c.recipe.autoinclude/trunk/CHANGES.txt
  U   z3c.recipe.autoinclude/trunk/src/z3c/recipe/autoinclude/dependency.py

-=-
Modified: z3c.recipe.autoinclude/branches/0.2.2dev/CHANGES.txt
===================================================================
--- z3c.recipe.autoinclude/branches/0.2.2dev/CHANGES.txt	2010-01-18 17:18:46 UTC (rev 108209)
+++ z3c.recipe.autoinclude/branches/0.2.2dev/CHANGES.txt	2010-01-18 17:27:47 UTC (rev 108210)
@@ -2,6 +2,12 @@
 CHANGES
 =======
 
+0.2.2 (2009-01-18)
+------------------
+
+- Fixed dependency order (Takayuki Shimizukawa)
+
+
 0.2.1 (2010-01-15)
 ------------------
 

Modified: z3c.recipe.autoinclude/branches/0.2.2dev/setup.py
===================================================================
--- z3c.recipe.autoinclude/branches/0.2.2dev/setup.py	2010-01-18 17:18:46 UTC (rev 108209)
+++ z3c.recipe.autoinclude/branches/0.2.2dev/setup.py	2010-01-18 17:27:47 UTC (rev 108210)
@@ -21,7 +21,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version='0.2.1'
+version='0.2.2'
 
 
 setup(name='z3c.recipe.autoinclude',

Modified: z3c.recipe.autoinclude/branches/0.2.2dev/src/z3c/recipe/autoinclude/dependency.py
===================================================================
--- z3c.recipe.autoinclude/branches/0.2.2dev/src/z3c/recipe/autoinclude/dependency.py	2010-01-18 17:18:46 UTC (rev 108209)
+++ z3c.recipe.autoinclude/branches/0.2.2dev/src/z3c/recipe/autoinclude/dependency.py	2010-01-18 17:27:47 UTC (rev 108210)
@@ -38,7 +38,7 @@
         for req in self.context.requires():
             pkg = req.project_name
 
-            if pkg in seen or pkg == 'setuptools':
+            if pkg == 'setuptools':
                 continue
 
             # get info from requirenments
@@ -46,28 +46,41 @@
             if dist is None:
                 continue
 
-            info = DependencyFinder(
-                self.ws.find(req), self.ws).includableInfo(zcml_to_look_for, seen)
+            if pkg in seen:
+                result = add_context_to_result(
+                            DependencyFinder(dist, self.ws),
+                            result, zcml_to_look_for, True)
 
-            for key, items in info.items():
-                data = result[key]
-                for item in items:
-                    if item not in data:
-                        data.append(item)
+            else:
+                info = DependencyFinder(
+                    self.ws.find(req), self.ws).includableInfo(zcml_to_look_for, seen)
 
-        # get info for self
-        for path in self.paths():
-            for candidate in zcml_to_look_for:
-                candidate_path = os.path.join(
-                    self.context.location, path, candidate)
+                for key, items in info.items():
+                    data = result[key]
+                    for item in items:
+                        if item not in data:
+                            data.append(item)
 
-                if os.path.isfile(candidate_path):
-                    name = path.replace(os.path.sep, '.')
+        return add_context_to_result(self, result, zcml_to_look_for)
+
+
+def add_context_to_result(self, result, zcml_to_look_for, precede=False):
+    # get info for context
+    for path in self.paths():
+        for candidate in zcml_to_look_for:
+            candidate_path = os.path.join(
+                self.context.location, path, candidate)
+
+            if os.path.isfile(candidate_path):
+                name = path.replace(os.path.sep, '.')
+                if name not in result[candidate]:
                     result[candidate].append(name)
+                elif precede:
+                    result[candidate].remove(name)
+                    result[candidate].insert(0, name)
+    return result
 
-        return result
 
-
 def subpackageDottedNames(package_path, ns_path=None):
     # we do not look for subpackages in zipped eggs
     if not os.path.isdir(package_path):

Modified: z3c.recipe.autoinclude/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.autoinclude/trunk/CHANGES.txt	2010-01-18 17:18:46 UTC (rev 108209)
+++ z3c.recipe.autoinclude/trunk/CHANGES.txt	2010-01-18 17:27:47 UTC (rev 108210)
@@ -2,6 +2,12 @@
 CHANGES
 =======
 
+0.2.2 (2009-01-18)
+------------------
+
+- Fixed dependency order (Takayuki Shimizukawa)
+
+
 0.2.1 (2010-01-15)
 ------------------
 

Modified: z3c.recipe.autoinclude/trunk/src/z3c/recipe/autoinclude/dependency.py
===================================================================
--- z3c.recipe.autoinclude/trunk/src/z3c/recipe/autoinclude/dependency.py	2010-01-18 17:18:46 UTC (rev 108209)
+++ z3c.recipe.autoinclude/trunk/src/z3c/recipe/autoinclude/dependency.py	2010-01-18 17:27:47 UTC (rev 108210)
@@ -22,7 +22,6 @@
         result = []
         for ns_path in ns_paths:
             path = os.path.join(dist_path, ns_path)
-
             subpackages = subpackageDottedNames(path, ns_path)
             for subpackage in subpackages:
                 if subpackage not in ns_paths:
@@ -31,7 +30,7 @@
 
     def includableInfo(self, zcml_to_look_for, seen=None):
         result = dict([(key, []) for key in zcml_to_look_for])
-
+        
         if seen is None:
             seen = set()
 
@@ -41,7 +40,7 @@
         for req in self.context.requires():
             pkg = req.project_name
 
-            if pkg.startswith('zope.app.') or pkg in ('zope.formlib', 'z3ext.resource'):
+            if pkg.startswith('zope.app.') or pkg in ('zope.formlib',):
                 global deps
                 d = deps[1].setdefault(self.context.project_name, [])
                 if pkg not in d:
@@ -51,7 +50,8 @@
                 if self.context.project_name not in d:
                     d.append(self.context.project_name)
 
-            if pkg in seen or pkg == 'setuptools':
+
+            if pkg == 'setuptools':
                 continue
 
             # get info from requirenments
@@ -59,28 +59,41 @@
             if dist is None:
                 continue
 
-            info = DependencyFinder(
-                self.ws.find(req), self.ws).includableInfo(zcml_to_look_for, seen)
+            if pkg in seen:
+                result = add_context_to_result(
+                            DependencyFinder(dist, self.ws),
+                            result, zcml_to_look_for, True)
 
-            for key, items in info.items():
-                data = result[key]
-                for item in items:
-                    if item not in data:
-                        data.append(item)
+            else:
+                info = DependencyFinder(
+                    self.ws.find(req), self.ws).includableInfo(zcml_to_look_for, seen)
 
-        # get info for self
-        for path in self.paths():
-            for candidate in zcml_to_look_for:
-                candidate_path = os.path.join(
-                    self.context.location, path, candidate)
+                for key, items in info.items():
+                    data = result[key]
+                    for item in items:
+                        if item not in data:
+                            data.append(item)
 
-                if os.path.isfile(candidate_path):
-            	    name = path.replace(os.path.sep, '.')
+        return add_context_to_result(self, result, zcml_to_look_for)
+
+
+def add_context_to_result(self, result, zcml_to_look_for, precede=False):
+    # get info for context
+    for path in self.paths():
+        for candidate in zcml_to_look_for:
+            candidate_path = os.path.join(
+                self.context.location, path, candidate)
+
+            if os.path.isfile(candidate_path):
+                name = path.replace(os.path.sep, '.')
+                if name not in result[candidate]:
                     result[candidate].append(name)
+                elif precede:
+                    result[candidate].remove(name)
+                    result[candidate].insert(0, name)
+    return result
 
-        return result
 
-
 def subpackageDottedNames(package_path, ns_path=None):
     # we do not look for subpackages in zipped eggs
     if not os.path.isdir(package_path):



More information about the checkins mailing list