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

Fred L. Drake, Jr. fred at zope.com
Tue May 25 10:34:49 EDT 2004


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

Modified Files:
	include.py 
Log Message:
make sure nested PACKAGE.cfg files are processed


=== Packages/zpkgtools/zpkgtools/include.py 1.42 => 1.43 ===
--- Packages/zpkgtools/zpkgtools/include.py:1.42	Thu May 20 12:35:35 2004
+++ Packages/zpkgtools/zpkgtools/include.py	Tue May 25 10:34:18 2004
@@ -276,7 +276,7 @@
         self.group = group
 
     def __nonzero__(self):
-        return bool(self.includes)
+        return bool(self.includes or self.excludes)
 
     def cook(self):
         patterns = self.includes.pop(None, [])
@@ -360,6 +360,11 @@
         """
         self.create_directory(source, destination)
         prefix = os.path.join(source, "")
+
+        # The directory walk *must* be performed in top-down fashion
+        # since the handling of nested PACKAGE_CONF files must be able
+        # to modify the list of directories which are considered.
+        #
         for dirname, dirs, files in os.walk(source, topdown=True):
             dirs[:] = filter_names(dirs)
             files = filter_names(files)
@@ -368,6 +373,24 @@
             # relative to destination.  It will be '' at the top
             # level.
             reldir = dirname[len(prefix):]
+            if reldir:
+                destdir = os.path.join(destination, reldir)
+            else:
+                destdir = destination
+
+            if PACKAGE_CONF in files and dirname != source:
+                # a nested PACKAGE.cfg needs to be handled as well
+                specs = load(dirname)
+                if specs.loads:
+                    raise InclusionSpecificationError(
+                        "<load> disallowed in a nested %s file"
+                        % PACKAGE_CONF)
+                if specs.collection:
+                    specs.collection.cook()
+                    self.createDistributionTree(destdir, specs.collection)
+                    del dirs[:]
+                    continue
+
             if excludes:
                 # excludes are in POSIX path notation
                 preldir = reldir.replace(os.sep, "/")
@@ -379,10 +402,7 @@
                     prelpath = posixpath.join(preldir, name)
                     if prelpath in excludes:
                         files.remove(name)
-            if reldir:
-                destdir = os.path.join(destination, reldir)
-            else:
-                destdir = destination
+
             for file in files:
                 srcname = os.path.join(dirname, file)
                 destname = os.path.join(destdir, file)




More information about the Zope-CVS mailing list