[Buildbot-commits] buildbot/buildbot/slave commands.py,1.58,1.59

Brian Warner warner at users.sourceforge.net
Sun Aug 6 23:30:20 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv382/buildbot/slave

Modified Files:
	commands.py 
Log Message:
[project @ slave.commands.ShellCommand: handle os.pathsep in PYTHONPATH]
making PYTHONPATH even more of a magic special-case in the environs.

Original author: Kevin Turner <kevin at janrain.com>
Date: 2006-08-02 02:58:45

Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- commands.py	6 Aug 2006 22:37:20 -0000	1.58
+++ commands.py	6 Aug 2006 23:30:18 -0000	1.59
@@ -231,15 +231,24 @@
         self.workdir = workdir
         self.environ = os.environ.copy()
         if environ:
-            if (self.environ.has_key('PYTHONPATH')
-                and environ.has_key('PYTHONPATH')):
-                # special case, prepend the builder's items to the existing
-                # ones. This will break if you send over empty strings, so
-                # don't do that.
-                environ['PYTHONPATH'] = (environ['PYTHONPATH']
-                                         + os.pathsep
-                                         + self.environ['PYTHONPATH'])
-                # this will proceed to replace the old one
+            if environ.has_key('PYTHONPATH'):
+                ppath = environ['PYTHONPATH']
+                # Need to do os.pathsep translation.  We could either do that
+                # by replacing all incoming ':'s with os.pathsep, or by
+                # accepting lists.  I like lists better.
+                if not isinstance(ppath, str):
+                    # If it's not a string, treat it as a sequence to be
+                    # turned in to a string.
+                    ppath = os.pathsep.join(ppath)
+
+                if self.environ.has_key('PYTHONPATH'):
+                    # special case, prepend the builder's items to the
+                    # existing ones. This will break if you send over empty
+                    # strings, so don't do that.
+                    ppath = ppath + os.pathsep + self.environ['PYTHONPATH']
+
+                environ['PYTHONPATH'] = ppath
+
             self.environ.update(environ)
         self.initialStdin = initialStdin
         self.keepStdinOpen = keepStdinOpen





More information about the Commits mailing list