[Buildbot-commits] buildbot/buildbot/changes pb.py,1.3,1.4

Brian Warner warner at users.sourceforge.net
Mon Nov 8 19:38:12 UTC 2004


Update of /cvsroot/buildbot/buildbot/buildbot/changes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10125/buildbot/changes

Modified Files:
	pb.py 
Log Message:
(ChangePerspective): use a configurable separator character instead of
os.sep, because the filenames being split here are coming from the VC system,
which can have a different pathname convention than the local host. This
should help a buildmaster running on windows that uses a CVS repository which
runs under unix.


Index: pb.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/pb.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pb.py	8 Sep 2004 19:15:30 -0000	1.3
+++ pb.py	8 Nov 2004 19:38:09 -0000	1.4
@@ -10,9 +10,13 @@
 
 class ChangePerspective(NewCredPerspective):
 
-    def __init__(self, changemaster, prefix):
+    def __init__(self, changemaster, prefix, sep="/"):
         self.changemaster = changemaster
         self.prefix = prefix
+        # this is the separator as used by the VC system, not the local host.
+        # If for some reason you're running your CVS repository under
+        # windows, you'll need to use a PBChangeSource(sep="\\")
+        self.sep = sep
 
     def attached(self, mind):
         pass
@@ -22,10 +26,10 @@
         pathnames = []
         for path in changedict['files']:
             if self.prefix:
-                bits = path.split(os.sep)
+                bits = path.split(self.sep)
                 if bits[0] == self.prefix:
                     if bits[1:]:
-                        path = os.path.join(*bits[1:])
+                        path = self.sep.join(bits[1:])
                     else:
                         path = ''
                 else:
@@ -43,7 +47,7 @@
     __implements__ = IChangeSource, service.Service.__implements__
 
     def __init__(self, user="change", passwd="changepw", port=None,
-                 prefix=None):
+                 prefix=None, sep="/"):
         # TODO: current limitations
         assert user == "change"
         assert passwd == "changepw"
@@ -52,6 +56,7 @@
         self.passwd = passwd
         self.port = port
         self.prefix = prefix
+        self.sep = sep
 
     def describe(self):
         # TODO: when the dispatcher is fixed, report the specific port
@@ -76,5 +81,5 @@
         master.dispatcher.unregister(self.user)
 
     def getPerspective(self):
-        return ChangePerspective(self.parent, self.prefix)
+        return ChangePerspective(self.parent, self.prefix, self.sep)
 





More information about the Commits mailing list