[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - include.py:1.44

Fred L. Drake, Jr. fred at zope.com
Tue May 25 16:08:17 EDT 2004


Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv6613/zpkgtools

Modified Files:
	include.py 
Log Message:
There's an edge case when a directory is included explicity by a
parent, but includes a PACKAGE_CONF file itself.  The nested
PACKAGE_CONF wasn't being processed.

This fixes that edge case and adds a test that guards against a
regression for that case.


=== Packages/zpkgtools/zpkgtools/include.py 1.43 => 1.44 ===
--- Packages/zpkgtools/zpkgtools/include.py:1.43	Tue May 25 10:34:18 2004
+++ Packages/zpkgtools/zpkgtools/include.py	Tue May 25 16:07:46 2004
@@ -339,9 +339,10 @@
             self.create_directory(spec.source, destination)
             self.addIncludes(destination, spec)
         else:
-            self.copyTree(spec.source, destination, spec.excludes)
+            self.copyTree(spec.source, destination, spec.excludes,
+                          nested=False)
 
-    def copyTree(self, source, destination, excludes=()):
+    def copyTree(self, source, destination, excludes=(), nested=True):
         """Populate the destination tree from the source tree.
 
         :Parameters:
@@ -358,6 +359,13 @@
         Files and directories will be created with the same permission
         bits and stat info as the source tree.
         """
+        # The `nested` flag is only for internal use; it should be
+        # False only when calling copyTree based on a specification
+        # object represented by a PACKAGE_CONF file located in the
+        # directory identified by `source`.  For any other call,
+        # `nested` should be True since PACKAGE_CONF files need to be
+        # processed.
+
         self.create_directory(source, destination)
         prefix = os.path.join(source, "")
 
@@ -378,7 +386,7 @@
             else:
                 destdir = destination
 
-            if PACKAGE_CONF in files and dirname != source:
+            if PACKAGE_CONF in files and ((dirname != source) or nested):
                 # a nested PACKAGE.cfg needs to be handled as well
                 specs = load(dirname)
                 if specs.loads:




More information about the Zope-CVS mailing list