[py-svn] r31984 - py/branch/distributed/py/test/rsession

arigo at codespeak.net arigo at codespeak.net
Mon Sep 4 14:29:33 CEST 2006


Author: arigo
Date: Mon Sep  4 14:29:32 2006
New Revision: 31984

Modified:
   py/branch/distributed/py/test/rsession/hostmanage.py
   py/branch/distributed/py/test/rsession/rsync.py
Log:
Bug fix in the presence of symlinks.  A few more details.


Modified: py/branch/distributed/py/test/rsession/hostmanage.py
==============================================================================
--- py/branch/distributed/py/test/rsession/hostmanage.py	(original)
+++ py/branch/distributed/py/test/rsession/hostmanage.py	Mon Sep  4 14:29:32 2006
@@ -12,9 +12,9 @@
 
 class HostRSync(RSync):
 
-    def __init__(self, rsync_files):
+    def __init__(self, rsync_roots):
         RSync.__init__(self, delete=True)
-        self.rsync_files = rsync_files
+        self.rsync_roots = rsync_roots
 
     def filter(self, path):
         if path.endswith('.pyc') or path.endswith('~'):
@@ -22,10 +22,10 @@
         dir, base = os.path.split(path)
         if base == '.svn':
             return False
-        if self.rsync_files is None or dir != self.sourcedir:
+        if self.rsync_roots is None or dir != self.sourcedir:
             return True
         else:
-            return base in self.rsync_files
+            return base in self.rsync_roots
 
 
 def init_hosts(reporter, sshhosts, relpath, pkgdir, rsync_roots=None):

Modified: py/branch/distributed/py/test/rsession/rsync.py
==============================================================================
--- py/branch/distributed/py/test/rsession/rsync.py	(original)
+++ py/branch/distributed/py/test/rsession/rsync.py	Mon Sep  4 14:29:32 2006
@@ -24,6 +24,8 @@
 
     def send(self, sourcedir):
         self.sourcedir = str(sourcedir)
+        # normalize a trailing '/' away
+        self.sourcedir = os.path.dirname(os.path.join(self.sourcedir, 'x'))
         # send directory structure and file timestamps/sizes
         self._send_directory_structure(self.sourcedir)
         # send modified file to clients
@@ -77,7 +79,7 @@
             for p in subpaths:
                 self._send_directory_structure(p)
         elif stat.S_ISLNK(st.st_mode):
-            pass     # ignore symlinks for now
+            self._broadcast(None)     # ignore symlinks for now
         else:
             raise ValueError, "cannot sync %r" % (path,)
 
@@ -117,7 +119,7 @@
                     if othername not in entrynames:
                         otherpath = os.path.join(path, othername)
                         remove(otherpath)
-        else:
+        elif msg is not None:
             if st and stat.S_ISREG(st.st_mode):
                 mystamp = (st.st_mtime, st.st_size)
             else:



More information about the pytest-commit mailing list