[Commits] (markie) Bug 1520; manifests contain CVS directories; r=morgen

commits at osafoundation.org commits at osafoundation.org
Sun Jul 25 00:23:02 PDT 2004


Commit by: markie
Modified files:
hardhat/hardhatlib.py 1.77 1.78

Log message:
Bug 1520;manifests contain CVS directories;r=morgen

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/hardhat/hardhatlib.py.diff?r1=text&tr1=1.77&r2=text&tr2=1.78

Index: hardhat/hardhatlib.py
diff -u hardhat/hardhatlib.py:1.77 hardhat/hardhatlib.py:1.78
--- hardhat/hardhatlib.py:1.77	Mon Jul 19 15:02:39 2004
+++ hardhat/hardhatlib.py	Sun Jul 25 00:22:31 2004
@@ -1,5 +1,5 @@
-__version__     = "$Revision: 1.77 $"
-__date__        = "$Date: 2004/07/19 22:02:39 $"
+__version__     = "$Revision: 1.78 $"
+__date__        = "$Date: 2004/07/25 07:22:31 $"
 __copyright__   = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__     = "GPL -- see LICENSE.txt"
 
@@ -1190,6 +1190,7 @@
     params["dest"] = None
     params["recursive"] = True
     params["glob"] = "*"
+    params["exclude"] = "CVS"
     srcdir = buildenv['root']
     destdir = buildenv['distdir']
 
@@ -1220,13 +1221,15 @@
                 else:
                     params["recursive"] = False
                 log(buildenv, HARDHAT_MESSAGE, "HardHat", "recursive=" + value)
-
+            if name == "exclude":
+                params["exclude"] = value.split(",")
+                log(buildenv, HARDHAT_MESSAGE, "HardHat", "exclude=" + value)
         else:
             abspath = os.path.join(srcdir,line)
             if os.path.isdir(abspath):
                 log(buildenv, HARDHAT_MESSAGE, "HardHat", abspath)
                 copyto = os.path.join(buildenv['distdir'], params["dest"], line)
-                _copyTree(abspath, copyto, params["recursive"], params["glob"])
+                _copyTree(abspath, copyto, params["recursive"], params["glob"], params["exclude"])
             else:
                 if os.path.exists(abspath):
                     log(buildenv, HARDHAT_MESSAGE, "HardHat", abspath)
@@ -1285,12 +1288,12 @@
     return line
     
 
-def _copyTree(srcdir, destdir, recursive, patterns):
+def _copyTree(srcdir, destdir, recursive, patterns, excludes):
     os.chdir(srcdir)
     for pattern in patterns:
         matches = glob.glob(pattern)
         for match in matches:
-            if os.path.isfile(match):
+            if os.path.isfile(match) and not match in excludes:
                 if not os.path.exists(destdir):
                     _mkdirs(destdir)
                 if os.path.islink(match):
@@ -1301,9 +1304,9 @@
     if recursive:
         for name in os.listdir(srcdir):
             full_name = os.path.join(srcdir, name)
-            if os.path.isdir(full_name):
+            if os.path.isdir(full_name) and not name in excludes:
                 _copyTree(full_name, os.path.join(destdir, name), True, 
-                 patterns)
+                 patterns, excludes)
 
 def _mkdirs(newdir, mode=0777):
     try: 
@@ -1327,18 +1330,18 @@
                     _mkdirs(destdir)
                 shutil.copy(match, destdir)
 
-def copyTree(srcdir, destdir, patterns):
+def copyTree(srcdir, destdir, patterns, excludes):
     for pattern in patterns:
         matches = glob.glob(os.path.join(srcdir, pattern))
         for match in matches:
-            if os.path.isfile(match):
+            if os.path.isfile(match) and not match in excludes:
                 if not os.path.exists(destdir):
                     _mkdirs(destdir)
                 shutil.copy(match, destdir)
     for name in os.listdir(srcdir):
         fullpath = os.path.join(srcdir, name)
-        if os.path.isdir(fullpath):
-            copyTree(fullpath, os.path.join(destdir, name), patterns)
+        if os.path.isdir(fullpath) and not name in excludes:
+            copyTree(fullpath, os.path.join(destdir, name), patterns, excludes)
 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



More information about the Commits mailing list