[Buildbot-commits] buildbot/buildbot/changes mail.py,1.14,1.15

Brian Warner warner at users.sourceforge.net
Mon Nov 8 19:43:54 UTC 2004


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

Modified Files:
	mail.py 
Log Message:
* buildbot/changes/pb.py (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.

* buildbot/changes/mail.py (MaildirSource): same, for all parsers


Index: mail.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/mail.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mail.py	12 Oct 2004 17:51:04 -0000	1.14
+++ mail.py	8 Nov 2004 19:43:51 -0000	1.15
@@ -11,7 +11,7 @@
 from buildbot.changes.maildirtwisted import MaildirTwisted
 from buildbot.changes.changes import Change
 
-def parseFreshCVSMail(self, fd, prefix=None):
+def parseFreshCVSMail(self, fd, prefix=None, sep="/"):
     """Parse mail sent by FreshCVS"""
     # this uses rfc822.Message so it can run under python2.1 . In the future
     # it will be updated to use python2.2's "email" module.
@@ -50,9 +50,9 @@
         if prefix:
             # insist that the file start with the prefix: FreshCVS sends
             # changes we don't care about too
-            bits = file.split(os.sep)
+            bits = file.split(sep)
             if bits[0] == prefix:
-                file = apply(os.path.join, bits[1:])
+                file = sep.join(bits[1:])
             else:
                 break
         if len(linebits) == 1:
@@ -81,7 +81,7 @@
 
     return change
 
-def parseSyncmail(self, fd, prefix=None):
+def parseSyncmail(self, fd, prefix=None, sep="/"):
     """Parse messages sent by the 'syncmail' program, as suggested by the
     sourceforge.net CVS Admin documentation. Syncmail is maintained at
     syncmail.sf.net .
@@ -152,18 +152,18 @@
         # separator conventions established by the remote CVS server (which
         # is probably running on unix), not the local buildmaster system.
         thesefiles = line.split(" ")
-        for file in thesefiles:
-            file = os.path.join(directory, file)
+        for f in thesefiles:
+            f = sep.join([directory, f])
             if prefix:
                 # insist that the file start with the prefix: we may get
                 # changes we don't care about too
-                bits = file.split(os.sep)
+                bits = f.split(sep)
                 if bits[0] == prefix:
-                    file = apply(os.path.join, bits[1:])
+                    f = sep.join(bits[1:])
                 else:
                     break
             # TODO: figure out how new directories are described, set .isdir
-            files.append(file)
+            files.append(f)
 
     if not files:
         return None
@@ -288,15 +288,17 @@
     parser = None
     name = None
 
-    def __init__(self, maildir, prefix=None):
+    def __init__(self, maildir, prefix=None, sep="/"):
         MaildirTwisted.__init__(self, maildir)
         self.prefix = prefix
+        self.sep = sep
+
     def describe(self):
         return "%s mailing list in maildir %s" % (self.name, self.basedir)
 
     def messageReceived(self, filename):
         path = os.path.join(self.basedir, "new", filename)
-        change = self.parser(open(path, "r"), self.prefix)
+        change = self.parser(open(path, "r"), self.prefix, self.sep)
         if change:
             self.parent.addChange(change)
         os.rename(os.path.join(self.basedir, "new", filename),





More information about the Commits mailing list