[cig-commits] r6858 - cs/buildbot/trunk/buildbot/slave
leif at geodynamics.org
leif at geodynamics.org
Fri May 11 16:08:21 PDT 2007
Author: leif
Date: 2007-05-11 16:08:21 -0700 (Fri, 11 May 2007)
New Revision: 6858
Modified:
cs/buildbot/trunk/buildbot/slave/bot.py
cs/buildbot/trunk/buildbot/slave/commands.py
Log:
Merged changes from the field:
* Use makedirs() instead of mkdir() to create build directories. (Hey
Pythonistas: why not "mkdirs"? Grrr....)
* Treat any environment variable with "PATH" in the name in the same
special way that PYTHONPATH is treated: assume it is a
colon-separated list and prepend the server-side setting to the
client-side setting, instead of clobbering the client-side setting
with the server-side setting. This is useful for PATH,
LD_LIBRARY_PATH, ...
* Interpolate client-side environment variables into commands and
environment variables from the server. E.g., env={"LD_LIBRARY_PATH":
"%(HOME)s/opt/openmpi/lib"}, command=["./configure",
"--prefix=%(HOME)s/install"].
Modified: cs/buildbot/trunk/buildbot/slave/bot.py
===================================================================
--- cs/buildbot/trunk/buildbot/slave/bot.py 2007-05-11 23:07:43 UTC (rev 6857)
+++ cs/buildbot/trunk/buildbot/slave/bot.py 2007-05-11 23:08:21 UTC (rev 6858)
@@ -82,7 +82,7 @@
self.builddir = builddir
self.basedir = os.path.join(self.bot.basedir, self.builddir)
if not os.path.isdir(self.basedir):
- os.mkdir(self.basedir)
+ os.makedirs(self.basedir)
def stopService(self):
service.Service.stopService(self)
Modified: cs/buildbot/trunk/buildbot/slave/commands.py
===================================================================
--- cs/buildbot/trunk/buildbot/slave/commands.py 2007-05-11 23:07:43 UTC (rev 6857)
+++ cs/buildbot/trunk/buildbot/slave/commands.py 2007-05-11 23:08:21 UTC (rev 6858)
@@ -236,24 +236,29 @@
self.workdir = workdir
self.environ = os.environ.copy()
if environ:
- 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)
+ for var in environ.keys():
+ if var.find('PATH') != -1:
+ ppath = environ[var]
+ # 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']
+ if self.environ.has_key(var):
+ # 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[var]
- environ['PYTHONPATH'] = ppath
+ environ[var] = ppath
+ # interpolate my environment
+ for k,v in environ.items():
+ environ[k] = v % self.environ
+
self.environ.update(environ)
self.initialStdin = initialStdin
self.keepStdinOpen = keepStdinOpen
@@ -311,17 +316,19 @@
self.pp = ShellCommandPP(self)
if type(self.command) in types.StringTypes:
+ command = self.command % self.environ
if runtime.platformType == 'win32':
- argv = [os.environ['COMSPEC'], '/c', self.command]
+ argv = [os.environ['COMSPEC'], '/c', command]
else:
# for posix, use /bin/sh. for other non-posix, well, doesn't
# hurt to try
- argv = ['/bin/sh', '-c', self.command]
+ argv = ['/bin/sh', '-c', command]
else:
+ command = [arg % self.environ for arg in self.command]
if runtime.platformType == 'win32':
- argv = [os.environ['COMSPEC'], '/c'] + list(self.command)
+ argv = [os.environ['COMSPEC'], '/c'] + list(command)
else:
- argv = self.command
+ argv = command
# self.stdin is handled in ShellCommandPP.connectionMade
More information about the cig-commits
mailing list